|
83 | 83 | "max_file_size":100,
|
84 | 84 | }
|
85 | 85 |
|
| 86 | +service_account_content= { |
| 87 | +"name":"gitlab-service-account", |
| 88 | +"username":"gitlab-service-account", |
| 89 | +} |
| 90 | + |
86 | 91 |
|
87 | 92 | @pytest.fixture
|
88 | 93 | defresp_groups():
|
@@ -325,6 +330,19 @@ def resp_restore_group(created_content):
|
325 | 330 | yieldrsps
|
326 | 331 |
|
327 | 332 |
|
| 333 | +@pytest.fixture |
| 334 | +defresp_create_group_service_account(): |
| 335 | +withresponses.RequestsMock()asrsps: |
| 336 | +rsps.add( |
| 337 | +method=responses.POST, |
| 338 | +url="http://localhost/api/v4/groups/1/service_accounts", |
| 339 | +json=service_account_content, |
| 340 | +content_type="application/json", |
| 341 | +status=200, |
| 342 | + ) |
| 343 | +yieldrsps |
| 344 | + |
| 345 | + |
328 | 346 | deftest_get_group(gl,resp_groups):
|
329 | 347 | data=gl.groups.get(1)
|
330 | 348 | assertisinstance(data,gitlab.v4.objects.Group)
|
@@ -466,3 +484,11 @@ def test_delete_saml_group_link(group, resp_delete_saml_group_link):
|
466 | 484 |
|
467 | 485 | deftest_group_restore(group,resp_restore_group):
|
468 | 486 | group.restore()
|
| 487 | + |
| 488 | + |
| 489 | +deftest_create_group_service_account(group,resp_create_group_service_account): |
| 490 | +service_account=group.service_accounts.create( |
| 491 | + {"name":"gitlab-service-account","username":"gitlab-service-account"} |
| 492 | + ) |
| 493 | +assertservice_account.name=="gitlab-service-account" |
| 494 | +assertservice_account.username=="gitlab-service-account" |