8000 feat(unit): Add unit test for group_service_account delete · python-gitlab/python-gitlab@98c7f7b · GitHub
[go: up one dir, main page]

Skip to content

Commit 98c7f7b

Browse files
author
Rolf Offermanns
committed
feat(unit): Add unit test for group_service_account delete
1 parent 9c7d222 commit 98c7f7b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/unit/objects/test_groups.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
}
8585

8686
service_account_content = {
87+
"id": 42,
8788
"name": "gitlab-service-account",
8889
"username": "gitlab-service-account",
8990
}
@@ -343,6 +344,24 @@ def resp_create_group_service_account():
343344
yield rsps
344345

345346

347+
@pytest.fixture
348+
def resp_delete_group_service_account():
349+
with responses.RequestsMock() as rsps:
350+
rsps.add(
351+
method=responses.POST,
352+
url="http://localhost/api/v4/groups/1/service_accounts",
353+
json=service_account_content,
354+
content_type="application/json",
355+
status=200,
356+
)
357+
rsps.add(
358+
method=responses.DELETE,
359+
url="http://localhost/api/v4/groups/1/service_accounts/42",
360+
status=204,
361+
)
362+
yield rsps
363+
364+
346365
def test_get_group(gl, resp_groups):
347366
data = gl.groups.get(1)
348367
assert isinstance(data, gitlab.v4.objects.Group)
@@ -489,3 +508,10 @@ def test_create_group_service_account(group, resp_create_group_service_account):
489508
)
490509
assert service_account.name == "gitlab-service-account"
491510
assert service_account.username == "gitlab-service-account"
511+
512+
513+
def test_delete_group_service_account(group, resp_delete_group_service_account):
514+
service_account = group.service_accounts.create(
515+
{"name": "gitlab-service-account", "username": "gitlab-service-account"}
516+
)
517+
service_account.delete()

0 commit comments

Comments
 (0)
0