|
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 | yieldrsps |
344 | 345 |
|
345 | 346 |
|
| 347 | +@pytest.fixture |
| 348 | +defresp_delete_group_service_account(): |
| 349 | +withresponses.RequestsMock()asrsps: |
| 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 | +yieldrsps |
| 363 | + |
| 364 | + |
346 | 365 | deftest_get_group(gl,resp_groups): |
347 | 366 | data=gl.groups.get(1) |
348 | 367 | assertisinstance(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 | assertservice_account.name=="gitlab-service-account" |
491 | 510 | assertservice_account.username=="gitlab-service-account" |
| 511 | + |
| 512 | + |
| 513 | +deftest_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() |