|
84 | 84 | }
|
85 | 85 |
|
86 | 86 | service_account_content = {
|
| 87 | + "id": 42, |
87 | 88 | "name": "gitlab-service-account",
|
88 | 89 | "username": "gitlab-service-account",
|
89 | 90 | }
|
@@ -343,6 +344,24 @@ def resp_create_group_service_account():
|
343 | 344 | yield rsps
|
344 | 345 |
|
345 | 346 |
|
| 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 | + |
346 | 365 | def test_get_group(gl, resp_groups):
|
347 | 366 | data = gl.groups.get(1)
|
348 | 367 | assert isinstance(data, gitlab.v4.objects.Group)
|
@@ -489,3 +508,10 @@ def test_create_group_service_account(group, resp_create_group_service_account):
|
489 | 508 | )
|
490 | 509 | assert service_account.name == "gitlab-service-account"
|
491 | 510 | 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