52
52
"name" : "name" ,
53
53
},
54
54
}
55
- delete_project_content = {"message" : "202 Accepted" }
56
55
upload_file_content = {
57
56
"alt" : "filename" ,
58
57
"url" : "/uploads/66dbcd21ec5d24ed6ea225176098d52b/filename.png" ,
@@ -99,7 +98,7 @@ def resp_get_project():
99
98
100
99
101
100
@pytest .fixture
102
- def resp_post_project ():
101
+ def resp_create_project ():
103
102
with responses .RequestsMock () as rsps :
104
103
rsps .add (
105
104
method = responses .POST ,
@@ -112,7 +111,7 @@ def resp_post_project():
112
111
113
112
114
113
@pytest .fixture
115
- def resp_post_project_user ():
114
+ def resp_create_user_project ():
116
115
with responses .RequestsMock () as rsps :
117
116
rsps .add (
118
117
method = responses .POST ,
@@ -125,7 +124,7 @@ def resp_post_project_user():
125
124
126
125
127
126
@pytest .fixture
128
- def resp_post_fork_project ():
127
+ def resp_fork_project ():
129
128
with responses .RequestsMock () as rsps :
130
129
rsps .add (
131
130
method = responses .POST ,
@@ -138,7 +137,7 @@ def resp_post_fork_project():
138
137
139
138
140
139
@pytest .fixture
141
- def resp_put_project ():
140
+ def resp_update_project ():
142
141
with responses .RequestsMock () as rsps :
143
142
rsps .add (
144
143
method = responses .PUT ,
@@ -164,7 +163,7 @@ def resp_get_project_storage():
164
163
165
164
166
165
@pytest .fixture
167
- def resp_user_projects ():
166
+ def resp_list_user_projects ():
168
167
with responses .RequestsMock () as rsps :
169
168
rsps .add (
170
169
method = responses .GET ,
@@ -203,7 +202,7 @@ def resp_unstar_project():
203
202
204
203
205
204
@pytest .fixture
206
- def resp_project_starrers ():
205
+ def resp_list_project_starrers ():
207
206
with responses .RequestsMock () as rsps :
208
207
rsps .add (
209
208
method = responses .GET ,
@@ -216,7 +215,7 @@ def resp_project_starrers():
216
215
217
216
218
217
@pytest .fixture
219
- def resp_starred_projects ():
218
+ def resp_list_starred_projects ():
220
219
with responses .RequestsMock () as rsps :
221
220
rsps .add (
222
221
method = responses .GET ,
@@ -323,12 +322,12 @@ def resp_unarchive_project():
323
322
324
323
325
324
@pytest .fixture
326
- def resp_delete_project ():
325
+ def resp_delete_project (accepted_content ):
327
326
with responses .RequestsMock () as rsps :
328
327
rsps .add (
329
328
method = responses .DELETE ,
330
329
url = "http://localhost/api/v4/projects/1" ,
331
- json = delete_project_content ,
330
+ json = accepted_content ,
332
331
content_type = "application/json" ,
333
332
status = 202 ,
334
333
)
@@ -362,12 +361,12 @@ def resp_share_project():
362
361
363
362
364
363
@pytest .fixture
365
- def resp_unshare_project ():
364
+ def resp_unshare_project (no_content ):
366
365
with responses .RequestsMock () as rsps :
367
366
rsps .add (
368
367
method = responses .DELETE ,
369
368
url = "http://localhost/api/v4/projects/1/share/1" ,
370
- json = None ,
369
+ json = no_content ,
371
370
content_type = "application/json" ,
372
371
status = 204 ,
373
372
)
@@ -388,12 +387,12 @@ def resp_create_fork_relation():
388
387
389
388
390
389
@pytest .fixture
391
- def resp_delete_fork_relation ():
390
+ def resp_delete_fork_relation (no_content ):
392
391
with responses .RequestsMock () as rsps :
393
392
rsps .add (
394
393
method = responses .DELETE ,
395
394
url = "http://localhost/api/v4/projects/2/fork" ,
396
- json = None ,
395
+ json = no_content ,
397
396
content_type = "application/json" ,
398
397
status = 204 ,
399
398
)
@@ -440,7 +439,7 @@ def resp_start_housekeeping():
440
439
441
440
442
441
@pytest .fixture
443
- def resp_get_push_rules_project ():
442
+ def resp_list_push_rules_project ():
444
443
with responses .RequestsMock () as rsps :
445
444
rsps .add (
446
445
method = responses .GET ,
@@ -453,7 +452,7 @@ def resp_get_push_rules_project():
453
452
454
453
455
454
@pytest .fixture
456
- def resp_post_push_rules_project ():
455
+ def resp_create_push_rules_project ():
457
456
with responses .RequestsMock () as rsps :
458
457
rsps .add (
459
458
method = responses .POST ,
@@ -486,7 +485,7 @@ def resp_update_push_rules_project():
486
485
487
486
488
487
@pytest .fixture
489
- def resp_delete_push_rules_project ():
488
+ def resp_delete_push_rules_project (no_content ):
490
489
with responses .RequestsMock () as rsps :
491
490
rsps .add (
492
491
method = responses .GET ,
@@ -498,7 +497,7 @@ def resp_delete_push_rules_project():
498
497
rsps .add (
499
498
method = responses .DELETE ,
500
499
url = "http://localhost/api/v4/projects/1/push_rule" ,
501
- json = None ,
500
+ json = no_content ,
502
501
content_type = "application/json" ,
503
502
status = 204 ,
504
503
)
@@ -555,14 +554,14 @@ def test_list_projects(gl, resp_list_projects):
555
554
assert projects [0 ].name == "name"
556
555
557
556
558
- def test_list_user_projects (user , resp_user_projects ):
557
+ def test_list_user_projects (user , resp_list_user_projects ):
559
558
user_project = user .projects .list ()[0 ]
560
559
assert isinstance (user_project , UserProject )
561
560
assert user_project .name == "name"
562
561
assert user_project .id == 1
563
562
564
563
565
- def test_list_user_starred_projects (user , resp_starred_projects ):
564
+ def test_list_user_starred_projects (user , resp_list_starred_projects ):
566
565
starred_projects = user .starred_projects .list ()[0 ]
567
566
assert isinstance (starred_projects , StarredProject )
568
567
assert starred_projects .name == "name"
@@ -577,13 +576,13 @@ def test_list_project_users(project, resp_list_users):
577
576
assert user .state == "active"
578
577
579
578
580
- def test_create_project (gl , resp_post_project ):
579
+ def test_create_project (gl , resp_create_project ):
581
580
project = gl .projects .create ({"name" : "name" })
582
581
assert project .id == 1
583
582
assert project .name == "name"
584
583
585
584
586
- def test_create_user_project (user , resp_post_project_user ):
585
+ def test_create_user_project (user , resp_create_user_project ):
587
586
user_project = user .projects .create ({"name" : "name" })
588
587
assert user_project .id == 1
589
588
assert user_project .name == "name"
@@ -593,12 +592,12 @@ def test_create_user_project(user, resp_post_project_user):
593
592
assert user_project .owner .get ("username" ) == "owner_username"
594
593
595
594
596
- def test_update_project (project , resp_put_project ):
595
+ def test_update_project (project , resp_update_project ):
597
596
project .snippets_enabled = 1
598
597
project .save ()
599
598
600
599
601
- def test_fork_project (project , resp_post_fork_project ):
600
+ def test_fork_project (project , resp_fork_project ):
602
601
fork = project .forks .create ({})
603
602
assert fork .id == 2
604
603
assert fork .name == "name"
@@ -624,7 +623,7 @@ def test_unstar_project(project, resp_unstar_project):
624
623
625
624
626
625
@pytest .mark .skip (reason = "missing test" )
627
- def test_list_project_starrers (project , resp_project_starrers ):
626
+ def test_list_project_starrers (project , resp_list_project_starrers ):
628
627
pass
629
628
630
629
@@ -712,13 +711,13 @@ def test_project_housekeeping(project, resp_start_housekeeping):
712
711
project .housekeeping ()
713
712
714
713
715
- def test_get_project_push_rules (project , resp_get_push_rules_project ):
714
+ def test_list_project_push_rules (project , resp_list_push_rules_project ):
716
715
pr = project .pushrules .get ()
717
716
assert pr
718
717
assert pr .deny_delete_tag
719
718
720
719
721
- def test_create_project_push_rule (project , resp_post_push_rules_project ):
720
+ def test_create_project_push_rule (project , resp_create_push_rules_project ):
722
721
project .pushrules .create ({"deny_delete_tag" : True })
723
722
724
723
0 commit comments