mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-05 16:01:50 -05:00
Fixing test fallout from InventorySource model change
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user