@@ -809,6 +809,56 @@ def test_put_request_invalid_data(gl):
809809 assert responses .assert_call_count (url , 1 ) is True
810810
811811
812+ @responses .activate
813+ def test_patch_request (gl ):
814+ url = "http://localhost/api/v4/projects"
815+ responses .add (
816+ method = responses .PATCH ,
817+ url = url ,
818+ json = {"name" : "project1" },
819+ status = 200 ,
820+ match = helpers .MATCH_EMPTY_QUERY_PARAMS ,
821+ )
822+
823+ result = gl .http_patch ("/projects" )
824+ assert isinstance (result , dict )
825+ assert result ["name" ] == "project1"
826+ assert responses .assert_call_count (url , 1 ) is True
827+
828+
829+ @responses .activate
830+ def test_patch_request_404 (gl ):
831+ url = "http://localhost/api/v4/not_there"
832+ responses .add (
833+ method = responses .PATCH ,
834+ url = url ,
835+ json = [],
836+ status = 404 ,
837+ match = helpers .MATCH_EMPTY_QUERY_PARAMS ,
838+ )
839+
840+ with pytest .raises (GitlabHttpError ):
841+ gl .http_patch ("/not_there" )
842+ assert responses .assert_call_count (url , 1 ) is True
843+
844+
845+ @responses .activate
846+ def test_patch_request_invalid_data (gl ):
847+ url = "http://localhost/api/v4/projects"
848+ responses .add (
849+ method = responses .PATCH ,
850+ url = url ,
851+ body = '["name": "project1"]' ,
852+ content_type = "application/json" ,
853+ status = 200 ,
854+ match = helpers .MATCH_EMPTY_QUERY_PARAMS ,
855+ )
856+
857+ with pytest .raises (GitlabParsingError ):
858+ gl .http_patch ("/projects" )
859+ assert responses .assert_call_count (url , 1 ) is True
860+
861+
812862@responses .activate
813863def test_delete_request (gl ):
814864 url = "http://localhost/api/v4/projects"
0 commit comments