Fixing test fallout from InventorySource model change

This commit is contained in:
Wayne Witzel III
2017-04-07 00:37:12 -04:00
parent c784c96449
commit 4b5b56c284
5 changed files with 41 additions and 27 deletions

View File

@@ -4,17 +4,19 @@ from awx.api.versioning import reverse
@pytest.mark.django_db
def test_inventory_source_notification_on_cloud_only(get, post, group_factory, user, notification_template):
def test_inventory_source_notification_on_cloud_only(get, post, inventory_source_factory, user, notification_template):
u = user('admin', True)
g_cloud = group_factory('cloud')
g_not = group_factory('not_cloud')
cloud_is = g_cloud.inventory_source
not_is = g_not.inventory_source
cloud_is.source = 'ec2'
cloud_is = inventory_source_factory("ec2")
cloud_is.source = "ec2"
cloud_is.save()
not_is = inventory_source_factory("not_ec2")
url = reverse('api:inventory_source_notification_templates_any_list', kwargs={'pk': cloud_is.id})
response = post(url, dict(id=notification_template.id), u)
assert response.status_code == 204
url = reverse('api:inventory_source_notification_templates_success_list', kwargs={'pk': not_is.id})
response = post(url, dict(id=notification_template.id), u)
assert response.status_code == 400
@@ -178,5 +180,5 @@ def test_delete_inventory_host(delete, host, alice, role_field, expected_status_
@pytest.mark.django_db
def test_inventory_source_update(post, inventory_source, alice, role_field, expected_status_code):
if role_field:
getattr(inventory_source.group.inventory, role_field).members.add(alice)
getattr(inventory_source.inventory, role_field).members.add(alice)
post(reverse('api:inventory_source_update_view', kwargs={'pk': inventory_source.id}), {}, alice, expect=expected_status_code)