python-gitlab icon indicating copy to clipboard operation
python-gitlab copied to clipboard

feat(api): add DeleteMixin, ListMixin to GroupServiceAccountManager and ObjectDeleteMixin to GroupServiceAccount

Open ka28kumar opened this issue 1 year ago • 4 comments

add DeleteMixin, ListMixin to GroupServiceAccountManager and ObjectDeleteMixin to GroupServiceAccount

Changes

Documentation and testing

Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated:

ka28kumar avatar Sep 01 '24 13:09 ka28kumar

@nejch , Can you check if this is functionally complete? If it is, I'll start to add tests.

ka28kumar avatar Sep 01 '24 13:09 ka28kumar

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.53%. Comparing base (bcef988) to head (b57fbf2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2963   +/-   ##
=======================================
  Coverage   96.53%   96.53%           
=======================================
  Files          94       94           
  Lines        5997     5997           
=======================================
  Hits         5789     5789           
  Misses        208      208           
Flag Coverage Δ
api_func_v4 82.49% <100.00%> (-0.12%) :arrow_down:
cli_func_v4 83.47% <100.00%> (ø)
unit 88.52% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/v4/objects/service_accounts.py 100.00% <100.00%> (ø)

codecov[bot] avatar Sep 01 '24 13:09 codecov[bot]

Thanks for the contribution @ka28kumar I just got back to this.

Yes, this looks good! If you could add a few basic tests/asserts to the existing functional tests, this would be really appreciated! Thanks!

nejch avatar Sep 03 '24 08:09 nejch

Will add. Thanks!

ka28kumar avatar Sep 03 '24 12:09 ka28kumar

Did you still want to add a few tests here @ka28kumar? Could just be a simple extension of: https://github.com/python-gitlab/python-gitlab/blob/3739b5dd11bed66fb482cf6d2dc34382327a0265/tests/functional/api/test_groups.py#L315

E.g.:

def test_group_service_accounts(group):
    service_account = group.service_accounts.create(
        {"name": "gitlab-service-account", "username": "gitlab-service-account"}
    )
    assert service_account.name == "gitlab-service-account"
    assert service_account.username == "gitlab-service-account"

    service_accounts = group.service_accounts.list()
    assert service_accounts[0] == service_account

    service_account.delete()

Or something like that. Let me know otherwise we can also take over here!

nejch avatar Oct 23 '24 15:10 nejch

I'm sorry I got occupied with some tasks. Feel free to take over.

ka28kumar avatar Oct 24 '24 11:10 ka28kumar

Thanks @ka28kumar let's get this merged and I've opened a follow-up for the tests.

nejch avatar Nov 05 '24 16:11 nejch