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

Commite1d5f8d

Browse files
committed
test: cover .get_id() paths
Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
1 parent8273450 commite1d5f8d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎gitlab/v4/objects/job_token_scope.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def get_id(self) -> int:
4444
"""Returns the id of the resource. This override deals with
4545
the fact that either an `id` or a `target_project_id` attribute
4646
is returned by the server depending on the endpoint called."""
47-
project_id=cast(int,super().get_id())
48-
ifproject_idisnotNone:
49-
returnproject_id
47+
target_project_id=cast(int,super().get_id())
48+
iftarget_project_idisnotNone:
49+
returntarget_project_id
5050
returncast(int,self.id)
5151

5252

@@ -64,9 +64,9 @@ def get_id(self) -> int:
6464
"""Returns the id of the resource. This override deals with
6565
the fact that either an `id` or a `target_group_id` attribute
6666
is returned by the server depending on the endpoint called."""
67-
group_id=cast(int,super().get_id())
68-
ifgroup_idisnotNone:
69-
returngroup_id
67+
target_group_id=cast(int,super().get_id())
68+
iftarget_group_idisnotNone:
69+
returntarget_group_id
7070
returncast(int,self.id)
7171

7272

‎tests/unit/objects/test_job_token_scope.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def test_get_projects_allowlist(job_token_scope, resp_get_allowlist):
174174

175175
allowlist_content=allowlist.list()
176176
assertisinstance(allowlist_content,list)
177+
assertallowlist_content[0].get_id()==4
177178

178179

179180
deftest_add_project_to_allowlist(job_token_scope,resp_add_to_allowlist):
@@ -190,6 +191,7 @@ def test_get_groups_allowlist(job_token_scope, resp_get_groups_allowlist):
190191

191192
allowlist_content=allowlist.list()
192193
assertisinstance(allowlist_content,list)
194+
assertallowlist_content[0].get_id()==4
193195

194196

195197
deftest_add_group_to_allowlist(job_token_scope,resp_add_to_groups_allowlist):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp