From 5e626cfe2e90d03dfe4ceac65be973fde27f5784 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 29 Aug 2016 15:54:45 -0400 Subject: [PATCH] test_credential bug fixes Credential detail view was looked up with the organization's primary key. Works fine when the database arbitrarily gives them both pk=1 in a isolated test, but not a great thing to depend on. --- awx/main/tests/functional/api/test_credential.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/awx/main/tests/functional/api/test_credential.py b/awx/main/tests/functional/api/test_credential.py index 3c79e62e33..54f0bb0e20 100644 --- a/awx/main/tests/functional/api/test_credential.py +++ b/awx/main/tests/functional/api/test_credential.py @@ -317,18 +317,18 @@ def test_cant_change_organization(patch, credential, organization, org_admin): credential.organization = organization credential.save() - response = patch(reverse('api:credential_detail', args=(organization.id,)), { + response = patch(reverse('api:credential_detail', args=(credential.id,)), { 'name': 'Some new name', }, org_admin) assert response.status_code == 200 - response = patch(reverse('api:credential_detail', args=(organization.id,)), { + response = patch(reverse('api:credential_detail', args=(credential.id,)), { 'name': 'Some new name2', 'organization': organization.id, # fine for it to be the same }, org_admin) assert response.status_code == 200 - response = patch(reverse('api:credential_detail', args=(organization.id,)), { + response = patch(reverse('api:credential_detail', args=(credential.id,)), { 'name': 'Some new name3', 'organization': None }, org_admin) @@ -337,7 +337,7 @@ def test_cant_change_organization(patch, credential, organization, org_admin): @pytest.mark.django_db def test_cant_add_organization(patch, credential, organization, org_admin): assert credential.organization is None - response = patch(reverse('api:credential_detail', args=(organization.id,)), { + response = patch(reverse('api:credential_detail', args=(credential.id,)), { 'name': 'Some new name', 'organization': organization.id }, org_admin)