3434from gitlab import * # noqa
3535
3636
37- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects/1" ,
37+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects/1" ,
3838 method = "get" )
3939def resp_get_project (url , request ):
4040 headers = {'content-type' : 'application/json' }
4141 content = '{"name": "name", "id": 1}' .encode ("utf-8" )
4242 return response (200 , content , headers , None , 5 , request )
4343
4444
45- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects" ,
45+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects" ,
4646 method = "get" )
4747def resp_list_project (url , request ):
4848 headers = {'content-type' : 'application/json' }
4949 content = '[{"name": "name", "id": 1}]' .encode ("utf-8" )
5050 return response (200 , content , headers , None , 5 , request )
5151
5252
53- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /issues/1" ,
53+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /issues/1" ,
5454 method = "get" )
5555def resp_get_issue (url , request ):
5656 headers = {'content-type' : 'application/json' }
5757 content = '{"name": "name", "id": 1}' .encode ("utf-8" )
5858 return response (200 , content , headers , None , 5 , request )
5959
6060
61- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /users/1" ,
61+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /users/1" ,
6262 method = "put" )
6363def resp_update_user (url , request ):
6464 headers = {'content-type' : 'application/json' }
@@ -67,15 +67,15 @@ def resp_update_user(url, request):
6767 return response (200 , content , headers , None , 5 , request )
6868
6969
70- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects" ,
70+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects" ,
7171 method = "post" )
7272def resp_create_project (url , request ):
7373 headers = {'content-type' : 'application/json' }
7474 content = '{"name": "testname", "id": 1}' .encode ("utf-8" )
7575 return response (201 , content , headers , None , 5 , request )
7676
7777
78- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /groups/2/members" ,
78+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /groups/2/members" ,
7979 method = "post" )
8080def resp_create_groupmember (url , request ):
8181 headers = {'content-type' : 'application/json' }
@@ -84,14 +84,14 @@ def resp_create_groupmember(url, request):
8484
8585
8686@urlmatch (scheme = "http" , netloc = "localhost" ,
87- path = "/api/v3 /projects/2/snippets/3" , method = "get" )
87+ path = "/api/v4 /projects/2/snippets/3" , method = "get" )
8888def resp_get_projectsnippet (url , request ):
8989 headers = {'content-type' : 'application/json' }
9090 content = '{"title": "test", "id": 3}' .encode ("utf-8" )
9191 return response (200 , content , headers , None , 5 , request )
9292
9393
94- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /groups/1" ,
94+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /groups/1" ,
9595 method = "delete" )
9696def resp_delete_group (url , request ):
9797 headers = {'content-type' : 'application/json' }
@@ -100,7 +100,7 @@ def resp_delete_group(url, request):
100100
101101
102102@urlmatch (scheme = "http" , netloc = "localhost" ,
103- path = "/api/v3 /groups/2/projects/3" ,
103+ path = "/api/v4 /groups/2/projects/3" ,
104104 method = "post" )
105105def resp_transfer_project (url , request ):
106106 headers = {'content-type' : 'application/json' }
@@ -109,7 +109,7 @@ def resp_transfer_project(url, request):
109109
110110
111111@urlmatch (scheme = "http" , netloc = "localhost" ,
112- path = "/api/v3 /groups/2/projects/3" ,
112+ path = "/api/v4 /groups/2/projects/3" ,
113113 method = "post" )
114114def resp_transfer_project_fail (url , request ):
115115 headers = {'content-type' : 'application/json' }
@@ -118,7 +118,7 @@ def resp_transfer_project_fail(url, request):
118118
119119
120120@urlmatch (scheme = "http" , netloc = "localhost" ,
121- path = "/api/v3 /projects/2/repository/branches/branchname/protect" ,
121+ path = "/api/v4 /projects/2/repository/branches/branchname/protect" ,
122122 method = "put" )
123123def resp_protect_branch (url , request ):
124124 headers = {'content-type' : 'application/json' }
@@ -127,7 +127,7 @@ def resp_protect_branch(url, request):
127127
128128
129129@urlmatch (scheme = "http" , netloc = "localhost" ,
130- path = "/api/v3 /projects/2/repository/branches/branchname/unprotect" ,
130+ path = "/api/v4 /projects/2/repository/branches/branchname/unprotect" ,
131131 method = "put" )
132132def resp_unprotect_branch (url , request ):
133133 headers = {'content-type' : 'application/json' }
@@ -136,7 +136,7 @@ def resp_unprotect_branch(url, request):
136136
137137
138138@urlmatch (scheme = "http" , netloc = "localhost" ,
139- path = "/api/v3 /projects/2/repository/branches/branchname/protect" ,
139+ path = "/api/v4 /projects/2/repository/branches/branchname/protect" ,
140140 method = "put" )
141141def resp_protect_branch_fail (url , request ):
142142 headers = {'content-type' : 'application/json' }
@@ -157,7 +157,7 @@ def test_json(self):
157157 data = json .loads (json_str )
158158 self .assertIn ("id" , data )
159159 self .assertEqual (data ["username" ], "testname" )
160- self .assertEqual (data ["gitlab" ]["url" ], "http://localhost/api/v3 " )
160+ self .assertEqual (data ["gitlab" ]["url" ], "http://localhost/api/v4 " )
161161
162162 def test_pickability (self ):
163163 gl_object = CurrentUser (self .gl , data = {"username" : "testname" })
@@ -381,31 +381,31 @@ def setUp(self):
381381 self .obj = ProjectCommit (self .gl , data = {"id" : 3 , "project_id" : 2 })
382382
383383 @urlmatch (scheme = "http" , netloc = "localhost" ,
384- path = "/api/v3 /projects/2/repository/commits/3/diff" ,
384+ path = "/api/v4 /projects/2/repository/commits/3/diff" ,
385385 method = "get" )
386386 def resp_diff (self , url , request ):
387387 headers = {'content-type' : 'application/json' }
388388 content = '{"json": 2 }' .encode ("utf-8" )
389389 return response (200 , content , headers , None , 5 , request )
390390
391391 @urlmatch (scheme = "http" , netloc = "localhost" ,
392- path = "/api/v3 /projects/2/repository/commits/3/diff" ,
392+ path = "/api/v4 /projects/2/repository/commits/3/diff" ,
393393 method = "get" )
394394 def resp_diff_fail (self , url , request ):
395395 headers = {'content-type' : 'application/json' }
396396 content = '{"message": "messagecontent" }' .encode ("utf-8" )
397397 return response (400 , content , headers , None , 5 , request )
398398
399399 @urlmatch (scheme = "http" , netloc = "localhost" ,
400- path = "/api/v3 /projects/2/repository/blobs/3" ,
400+ path = "/api/v4 /projects/2/repository/blobs/3" ,
401401 method = "get" )
402402 def resp_blob (self , url , request ):
403403 headers = {'content-type' : 'application/json' }
404404 content = 'blob' .encode ("utf-8" )
405405 return response (200 , content , headers , None , 5 , request )
406406
407407 @urlmatch (scheme = "http" , netloc = "localhost" ,
408- path = "/api/v3 /projects/2/repository/blobs/3" ,
408+ path = "/api/v4 /projects/2/repository/blobs/3" ,
409409 method = "get" )
410410 def resp_blob_fail (self , url , request ):
411411 headers = {'content-type' : 'application/json' }
@@ -440,15 +440,15 @@ def setUp(self):
440440 self .obj = ProjectSnippet (self .gl , data = {"id" : 3 , "project_id" : 2 })
441441
442442 @urlmatch (scheme = "http" , netloc = "localhost" ,
443- path = "/api/v3 /projects/2/snippets/3/raw" ,
443+ path = "/api/v4 /projects/2/snippets/3/raw" ,
444444 method = "get" )
445445 def resp_content (self , url , request ):
446446 headers = {'content-type' : 'application/json' }
447447 content = 'content' .encode ("utf-8" )
448448 return response (200 , content , headers , None , 5 , request )
449449
450450 @urlmatch (scheme = "http" , netloc = "localhost" ,
451- path = "/api/v3 /projects/2/snippets/3/raw" ,
451+ path = "/api/v4 /projects/2/snippets/3/raw" ,
452452 method = "get" )
453453 def resp_content_fail (self , url , request ):
454454 headers = {'content-type' : 'application/json' }
@@ -474,15 +474,15 @@ def setUp(self):
474474 self .obj = Snippet (self .gl , data = {"id" : 3 })
475475
476476 @urlmatch (scheme = "http" , netloc = "localhost" ,
477- path = "/api/v3 /snippets/3/raw" ,
477+ path = "/api/v4 /snippets/3/raw" ,
478478 method = "get" )
479479 def resp_content (self , url , request ):
480480 headers = {'content-type' : 'application/json' }
481481 content = 'content' .encode ("utf-8" )
482482 return response (200 , content , headers , None , 5 , request )
483483
484484 @urlmatch (scheme = "http" , netloc = "localhost" ,
485- path = "/api/v3 /snippets/3/raw" ,
485+ path = "/api/v4 /snippets/3/raw" ,
486486 method = "get" )
487487 def resp_content_fail (self , url , request ):
488488 headers = {'content-type' : 'application/json' }
0 commit comments