diff --git a/awx/main/access.py b/awx/main/access.py index 7e98d4afcc..220609a7c4 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -899,6 +899,9 @@ class CredentialTypeAccess(BaseAccess): return False return super(CredentialTypeAccess, self).get_method_capability(method, obj, parent_obj) + def get_queryset(self): + return self.model.objects.all() + class CredentialAccess(BaseAccess): ''' diff --git a/awx/main/tests/functional/api/test_credential_type.py b/awx/main/tests/functional/api/test_credential_type.py index 919cee809c..e0666e60fa 100644 --- a/awx/main/tests/functional/api/test_credential_type.py +++ b/awx/main/tests/functional/api/test_credential_type.py @@ -14,16 +14,20 @@ def test_list_as_unauthorized_xfail(get): @pytest.mark.django_db def test_list_as_normal_user(get, alice): + ssh = CredentialType.defaults['ssh']() + ssh.save() response = get(reverse('api:credential_type_list'), alice) assert response.status_code == 200 - assert response.data['count'] == 0 + assert response.data['count'] == 1 @pytest.mark.django_db def test_list_as_admin(get, admin): + ssh = CredentialType.defaults['ssh']() + ssh.save() response = get(reverse('api:credential_type_list'), admin) assert response.status_code == 200 - assert response.data['count'] == 0 + assert response.data['count'] == 1 @pytest.mark.django_db