Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bef473

Browse files
TimKnight-DWPnejch
authored andcommitted
test: update api tests for GL 16.10
- Make sure we're testing python-gitlab functionality,make sure we're not awaiting on Gitlab Async functions- Decouple and improve test stabilitySigned-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
1 parentb81da2e commit4bef473

27 files changed

+140
-216
lines changed

‎tests/functional/api/test_boards.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ def test_project_boards(project):
55
board=project.boards.get(board.id)
66

77
project.boards.delete(board.id)
8-
assertnotproject.boards.list()
98

109

1110
deftest_group_boards(group):
@@ -15,4 +14,3 @@ def test_group_boards(group):
1514
board=group.boards.get(board.id)
1615

1716
group.boards.delete(board.id)
18-
assertnotgroup.boards.list()

‎tests/functional/api/test_bulk_imports.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importtime
2+
23
importpytest
34

45
importgitlab
@@ -15,14 +16,16 @@ def bulk_import_enabled(gl: gitlab.Gitlab):
1516
# todo: why so fussy with feature flag timing?
1617
time.sleep(5)
1718
get_settings=gl.settings.get()
18-
assertget_settings.bulk_import_enabled==True
19+
assertget_settings.bulk_import_enabledisTrue
1920

2021
yieldsettings
2122

2223
settings.bulk_import_enabled=bulk_import_default
2324
settings.save()
2425

2526

27+
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
28+
@pytest.mark.xfail(reason="Bulk Imports to be worked on in a follow up")
2629
deftest_bulk_imports(gl,group,bulk_import_enabled):
2730
destination=f"{group.full_path}-import"
2831
configuration= {

‎tests/functional/api/test_current_user.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ def test_current_user_email(gl):
44
assertmailingl.user.emails.list()
55

66
mail.delete()
7-
assertmailnotingl.user.emails.list()
87

98

109
deftest_current_user_gpg_keys(gl,GPG_KEY):
@@ -14,8 +13,8 @@ def test_current_user_gpg_keys(gl, GPG_KEY):
1413

1514
# Seems broken on the gitlab side
1615
gkey=gl.user.gpgkeys.get(gkey.id)
16+
1717
gkey.delete()
18-
assertgkeynotingl.user.gpgkeys.list()
1918

2019

2120
deftest_current_user_ssh_keys(gl,SSH_KEY):
@@ -24,7 +23,6 @@ def test_current_user_ssh_keys(gl, SSH_KEY):
2423
assertkeyingl.user.keys.list()
2524

2625
key.delete()
27-
assertkeynotingl.user.keys.list()
2826

2927

3028
deftest_current_user_status(gl):

‎tests/functional/api/test_deploy_keys.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ def test_project_deploy_keys(gl, project, DEPLOY_KEY):
77
assertdeploy_keyinproject2.keys.list()
88

99
project2.keys.delete(deploy_key.id)
10-
assertdeploy_keynotinproject2.keys.list()
10+
1111
project2.delete()

‎tests/functional/api/test_deploy_tokens.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
fromdatetimeimportdate
1+
importdatetime
22

33

44
deftest_project_deploy_tokens(gl,project):
5-
today=date.today().isoformat()
5+
today=datetime.date.today().isoformat()
66
deploy_token=project.deploytokens.create(
77
{
88
"name":"foo",
@@ -21,8 +21,6 @@ def test_project_deploy_tokens(gl, project):
2121
assertdeploy_token.username=="bar"
2222

2323
deploy_token.delete()
24-
assertdeploy_tokennotinproject.deploytokens.list()
25-
assertdeploy_tokennotingl.deploytokens.list()
2624

2725

2826
deftest_group_deploy_tokens(gl,group):
@@ -41,5 +39,3 @@ def test_group_deploy_tokens(gl, group):
4139
assertdeploy_token.scopes== ["read_registry"]
4240

4341
deploy_token.delete()
44-
assertdeploy_tokennotingroup.deploytokens.list()
45-
assertdeploy_tokennotingl.deploytokens.list()

‎tests/functional/api/test_epics.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def test_epic_issues(epic, issue):
2323
assertepic.issues.list()
2424

2525
epic_issue.delete()
26-
assertnotepic.issues.list()
2726

2827

2928
deftest_epic_notes(epic):

‎tests/functional/api/test_gitlab.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def test_broadcast_messages(gl, get_all_kwargs):
5353
assertmsg.color=="#444444"
5454

5555
msg.delete()
56-
assertmsgnotingl.broadcastmessages.list()
5756

5857

5958
deftest_markdown(gl):
@@ -151,7 +150,6 @@ def test_hooks(gl):
151150
asserthookingl.hooks.list()
152151

153152
hook.delete()
154-
asserthooknotingl.hooks.list()
155153

156154

157155
deftest_namespaces(gl,get_all_kwargs):
@@ -202,7 +200,6 @@ def test_features(gl):
202200
assertfeatingl.features.list()
203201

204202
feat.delete()
205-
assertfeatnotingl.features.list()
206203

207204

208205
deftest_pagination(gl,project):

‎tests/functional/api/test_groups.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ def test_groups(gl):
105105
assertresult[0].id==user.id
106106

107107
group1.members.delete(user.id)
108-
assertusernotingroup1.members.list()
108+
109109
assertgroup1.members_all.list()
110+
110111
member=group1.members.get(user2.id)
111112
member.access_level=gitlab.const.AccessLevel.OWNER
112113
member.save()
@@ -135,7 +136,6 @@ def test_group_labels(group):
135136
assertlabel.name=="Label:that requires:encoding"
136137

137138
label.delete()
138-
assertlabelnotingroup.labels.list()
139139

140140

141141
@pytest.mark.gitlab_premium
@@ -194,7 +194,6 @@ def test_group_badges(group):
194194
assertbadge.image_url=="http://another.example.com"
195195

196196
badge.delete()
197-
assertbadgenotingroup.badges.list()
198197

199198

200199
deftest_group_milestones(group):
@@ -228,7 +227,6 @@ def test_group_custom_attributes(gl, group):
228227
assertattringroup.customattributes.list()
229228

230229
attr.delete()
231-
assertattrnotingroup.customattributes.list()
232230

233231

234232
deftest_group_subgroups_projects(gl,user):
@@ -270,7 +268,6 @@ def test_group_wiki(group):
270268
wiki.save()
271269

272270
wiki.delete()
273-
assertwikinotingroup.wikis.list()
274271

275272

276273
@pytest.mark.gitlab_premium
@@ -285,7 +282,6 @@ def test_group_hooks(group):
285282
asserthook.note_eventsisTrue
286283

287284
hook.delete()
288-
asserthooknotingroup.hooks.list()
289285

290286

291287
deftest_group_transfer(gl,group):

‎tests/functional/api/test_import_export.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
importgitlab
66

77

8+
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
89
deftest_group_import_export(gl,group,temp_dir):
910
export=group.exports.create()
1011
assertexport.message=="202 Accepted"
@@ -31,6 +32,8 @@ def test_group_import_export(gl, group, temp_dir):
3132
assertgroup_import.name==import_name
3233

3334

35+
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
36+
@pytest.mark.xfail(reason="test_project_import_export to be worked on in a follow up")
3437
deftest_project_import_export(gl,project,temp_dir):
3538
export=project.exports.create()
3639
assertexport.message=="202 Accepted"
@@ -68,6 +71,8 @@ def test_project_import_export(gl, project, temp_dir):
6871
raiseException("Project import taking too much time")
6972

7073

74+
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
75+
@pytest.mark.xfail(reason="test_project_remote_import to be worked on in a follow up")
7176
deftest_project_remote_import(gl):
7277
withpytest.raises(gitlab.exceptions.GitlabImportError)aserr_info:
7378
gl.projects.remote_import(
@@ -80,6 +85,10 @@ def test_project_remote_import(gl):
8085
)
8186

8287

88+
# https://github.com/python-gitlab/python-gitlab/pull/2790#pullrequestreview-1873617123
89+
@pytest.mark.xfail(
90+
reason="test_project_remote_import_s3 to be worked on in a follow up"
91+
)
8392
deftest_project_remote_import_s3(gl):
8493
gl.features.set("import_project_from_remote_file_s3",True)
8594
withpytest.raises(gitlab.exceptions.GitlabImportError)aserr_info:

‎tests/functional/api/test_issues.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ def test_create_issue(project):
1818
assertissueinproject.issues.list(state="opened")
1919
assertissue2inproject.issues.list(state="closed")
2020

21-
assertisinstance(issue.user_agent_detail(),dict)
22-
assertissue.user_agent_detail()["user_agent"]
2321
assertissue.participants()
2422
asserttype(issue.closed_by())==list
2523
asserttype(issue.related_merge_requests())==list
@@ -33,10 +31,7 @@ def test_issue_notes(issue):
3331
assertemojiinnote.awardemojis.list()
3432

3533
emoji.delete()
36-
assertemojinotinnote.awardemojis.list()
37-
3834
note.delete()
39-
assertnotenotinissue.notes.list()
4035

4136

4237
deftest_issue_labels(project,issue):
@@ -62,8 +57,8 @@ def test_issue_links(project, issue):
6257
assertlinks
6358

6459
link_id=links[0].issue_link_id
60+
6561
issue.links.delete(link_id)
66-
assertnotissue.links.list()
6762

6863

6964
deftest_issue_label_events(issue):
@@ -114,5 +109,3 @@ def test_issue_discussions(issue):
114109
assertdiscussion.attributes["notes"][-1]["body"]=="updated body"
115110

116111
d_note_from_get.delete()
117-
discussion=issue.discussions.get(discussion.id)
118-
assertlen(discussion.attributes["notes"])==1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp