34
34
from gitlab import * # noqa
35
35
36
36
37
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects/1" ,
37
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects/1" ,
38
38
method = "get" )
39
39
def resp_get_project (url , request ):
40
40
headers = {'content-type' : 'application/json' }
41
41
content = '{"name": "name", "id": 1}' .encode ("utf-8" )
42
42
return response (200 , content , headers , None , 5 , request )
43
43
44
44
45
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects" ,
45
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects" ,
46
46
method = "get" )
47
47
def resp_list_project (url , request ):
48
48
headers = {'content-type' : 'application/json' }
49
49
content = '[{"name": "name", "id": 1}]' .encode ("utf-8" )
50
50
return response (200 , content , headers , None , 5 , request )
51
51
52
52
53
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /issues/1" ,
53
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /issues/1" ,
54
54
method = "get" )
55
55
def resp_get_issue (url , request ):
56
56
headers = {'content-type' : 'application/json' }
57
57
content = '{"name": "name", "id": 1}' .encode ("utf-8" )
58
58
return response (200 , content , headers , None , 5 , request )
59
59
60
60
61
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /users/1" ,
61
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /users/1" ,
62
62
method = "put" )
63
63
def resp_update_user (url , request ):
64
64
headers = {'content-type' : 'application/json' }
@@ -67,15 +67,15 @@ def resp_update_user(url, request):
67
67
return response (200 , content , headers , None , 5 , request )
68
68
69
69
70
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /projects" ,
70
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /projects" ,
71
71
method = "post" )
72
72
def resp_create_project (url , request ):
73
73
headers = {'content-type' : 'application/json' }
74
74
content = '{"name": "testname", "id": 1}' .encode ("utf-8" )
75
75
return response (201 , content , headers , None , 5 , request )
76
76
77
77
78
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /groups/2/members" ,
78
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /groups/2/members" ,
79
79
method = "post" )
80
80
def resp_create_groupmember (url , request ):
81
81
headers = {'content-type' : 'application/json' }
@@ -84,14 +84,14 @@ def resp_create_groupmember(url, request):
84
84
85
85
86
86
@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" )
88
88
def resp_get_projectsnippet (url , request ):
89
89
headers = {'content-type' : 'application/json' }
90
90
content = '{"title": "test", "id": 3}' .encode ("utf-8" )
91
91
return response (200 , content , headers , None , 5 , request )
92
92
93
93
94
- @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v3 /groups/1" ,
94
+ @urlmatch (scheme = "http" , netloc = "localhost" , path = "/api/v4 /groups/1" ,
95
95
method = "delete" )
96
96
def resp_delete_group (url , request ):
97
97
headers = {'content-type' : 'application/json' }
@@ -100,7 +100,7 @@ def resp_delete_group(url, request):
100
100
101
101
102
102
@urlmatch (scheme = "http" , netloc = "localhost" ,
103
- path = "/api/v3 /groups/2/projects/3" ,
103
+ path = "/api/v4 /groups/2/projects/3" ,
104
104
method = "post" )
105
105
def resp_transfer_project (url , request ):
106
106
headers = {'content-type' : 'application/json' }
@@ -109,7 +109,7 @@ def resp_transfer_project(url, request):
109
109
110
110
111
111
@urlmatch (scheme = "http" , netloc = "localhost" ,
112
- path = "/api/v3 /groups/2/projects/3" ,
112
+ path = "/api/v4 /groups/2/projects/3" ,
113
113
method = "post" )
114
114
def resp_transfer_project_fail (url , request ):
115
115
headers = {'content-type' : 'application/json' }
@@ -118,7 +118,7 @@ def resp_transfer_project_fail(url, request):
118
118
119
119
120
120
@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" ,
122
122
method = "put" )
123
123
def resp_protect_branch (url , request ):
124
124
headers = {'content-type' : 'application/json' }
@@ -127,7 +127,7 @@ def resp_protect_branch(url, request):
127
127
128
128
129
129
@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" ,
131
131
method = "put" )
132
132
def resp_unprotect_branch (url , request ):
133
133
headers = {'content-type' : 'application/json' }
@@ -136,7 +136,7 @@ def resp_unprotect_branch(url, request):
136
136
137
137
138
138
@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" ,
140
140
method = "put" )
141
141
def resp_protect_branch_fail (url , request ):
142
142
headers = {'content-type' : 'application/json' }
@@ -157,7 +157,7 @@ def test_json(self):
157
157
data = json .loads (json_str )
158
158
self .assertIn ("id" , data )
159
159
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 " )
161
161
162
162
def test_pickability (self ):
163
163
gl_object = CurrentUser (self .gl , data = {"username" : "testname" })
@@ -381,31 +381,31 @@ def setUp(self):
381
381
self .obj = ProjectCommit (self .gl , data = {"id" : 3 , "project_id" : 2 })
382
382
383
383
@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" ,
385
385
method = "get" )
386
386
def resp_diff (self , url , request ):
387
387
headers = {'content-type' : 'application/json' }
388
388
content = '{"json": 2 }' .encode ("utf-8" )
389
389
return response (200 , content , headers , None , 5 , request )
390
390
391
391
@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" ,
393
393
method = "get" )
394
394
def resp_diff_fail (self , url , request ):
395
395
headers = {'content-type' : 'application/json' }
396
396
content = '{"message": "messagecontent" }' .encode ("utf-8" )
397
397
return response (400 , content , headers , None , 5 , request )
398
398
399
399
@urlmatch (scheme = "http" , netloc = "localhost" ,
400
- path = "/api/v3 /projects/2/repository/blobs/3" ,
400
+ path = "/api/v4 /projects/2/repository/blobs/3" ,
401
401
method = "get" )
402
402
def resp_blob (self , url , request ):
403
403
headers = {'content-type' : 'application/json' }
404
404
content = 'blob' .encode ("utf-8" )
405
405
return response (200 , content , headers , None , 5 , request )
406
406
407
407
@urlmatch (scheme = "http" , netloc = "localhost" ,
408
- path = "/api/v3 /projects/2/repository/blobs/3" ,
408
+ path = "/api/v4 /projects/2/repository/blobs/3" ,
409
409
method = "get" )
410
410
def resp_blob_fail (self , url , request ):
411
411
headers = {'content-type' : 'application/json' }
@@ -440,15 +440,15 @@ def setUp(self):
440
440
self .obj = ProjectSnippet (self .gl , data = {"id" : 3 , "project_id" : 2 })
441
441
442
442
@urlmatch (scheme = "http" , netloc = "localhost" ,
443
- path = "/api/v3 /projects/2/snippets/3/raw" ,
443
+ path = "/api/v4 /projects/2/snippets/3/raw" ,
444
444
method = "get" )
445
445
def resp_content (self , url , request ):
446
446
headers = {'content-type' : 'application/json' }
447
447
content = 'content' .encode ("utf-8" )
448
448
return response (200 , content , headers , None , 5 , request )
449
449
450
450
@urlmatch (scheme = "http" , netloc = "localhost" ,
451
- path = "/api/v3 /projects/2/snippets/3/raw" ,
451
+ path = "/api/v4 /projects/2/snippets/3/raw" ,
452
452
method = "get" )
453
453
def resp_content_fail (self , url , request ):
454
454
headers = {'content-type' : 'application/json' }
@@ -474,15 +474,15 @@ def setUp(self):
474
474
self .obj = Snippet (self .gl , data = {"id" : 3 })
475
475
476
476
@urlmatch (scheme = "http" , netloc = "localhost" ,
477
- path = "/api/v3 /snippets/3/raw" ,
477
+ path = "/api/v4 /snippets/3/raw" ,
478
478
method = "get" )
479
479
def resp_content (self , url , request ):
480
480
headers = {'content-type' : 'application/json' }
481
481
content = 'content' .encode ("utf-8" )
482
482
return response (200 , content , headers , None , 5 , request )
483
483
484
484
@urlmatch (scheme = "http" , netloc = "localhost" ,
485
- path = "/api/v3 /snippets/3/raw" ,
485
+ path = "/api/v4 /snippets/3/raw" ,
486
486
method = "get" )
487
487
def resp_content_fail (self , url , request ):
488
488
headers = {'content-type' : 'application/json' }
0 commit comments