From 6c9bc91c96d80c228d787839adb73fdc76acf622 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Sat, 21 Oct 2023 09:35:14 -0400 Subject: [PATCH] Checkin. No-Issue Signed-off-by: James Tanner --- galaxy_ng/app/api/v1/viewsets/roles.py | 1 + .../integration/community/test_role_edits.py | 51 ++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/galaxy_ng/app/api/v1/viewsets/roles.py b/galaxy_ng/app/api/v1/viewsets/roles.py index 4028d82cc5..47c876cac7 100644 --- a/galaxy_ng/app/api/v1/viewsets/roles.py +++ b/galaxy_ng/app/api/v1/viewsets/roles.py @@ -134,6 +134,7 @@ def update(self, request, pk=None): # only save if changes made if changed: role.save() + return Response(changed, status=200) return Response(changed, status=204) diff --git a/galaxy_ng/tests/integration/community/test_role_edits.py b/galaxy_ng/tests/integration/community/test_role_edits.py index a79321a8ef..a9759ea8cc 100644 --- a/galaxy_ng/tests/integration/community/test_role_edits.py +++ b/galaxy_ng/tests/integration/community/test_role_edits.py @@ -84,5 +84,54 @@ def test_community_legacy_role_edit(ansible_config): args={'github_branch': 'fakebranch'} ) newds = admin_client(f'/api/v1/roles/{role_id}/') + assert newds['github_branch'] == 'fakebranch' - import epdb; epdb.st() + # change the github_user ... + admin_client( + f'/api/v1/roles/{role_id}/', + method='PUT', + args={'github_user': 'fakeuser'} + ) + newds = admin_client(f'/api/v1/roles/{role_id}/') + assert newds['github_user'] == 'fakeuser' + + # change the github_repo ... + admin_client( + f'/api/v1/roles/{role_id}/', + method='PUT', + args={'github_repo': 'fakerepo'} + ) + newds = admin_client(f'/api/v1/roles/{role_id}/') + assert newds['github_repo'] == 'fakerepo' + + # change the repository.name ... + admin_client( + f'/api/v1/roles/{role_id}/', + method='PUT', + args={ + 'repository': { + 'name': 'foorepo' + } + } + ) + newds = admin_client(f'/api/v1/roles/{role_id}/') + assert newds['summary_fields']['repository']['name'] == 'foorepo' + + # change the repository.original_name ... + admin_client( + f'/api/v1/roles/{role_id}/', + method='PUT', + args={ + 'repository': { + 'original_name': 'foorepo_old' + } + } + ) + newds = admin_client(f'/api/v1/roles/{role_id}/') + assert newds['summary_fields']['repository']['original_name'] == 'foorepo_old' + + # cleanup the role ... + try: + admin_client(f'/api/v1/roles/{role_id}/', method='DELETE') + except Exception as e: + pass