From 60008dbd745061c647435f425b711c294e4fb77c Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 12 Feb 2019 15:58:45 -0500 Subject: [PATCH] Add a test that AWX doesn't care about max_hosts when editing hosts on an inventory. --- awx/main/tests/functional/api/test_inventory.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/awx/main/tests/functional/api/test_inventory.py b/awx/main/tests/functional/api/test_inventory.py index 9bac17b4a2..d261f3e146 100644 --- a/awx/main/tests/functional/api/test_inventory.py +++ b/awx/main/tests/functional/api/test_inventory.py @@ -374,6 +374,18 @@ def test_edit_inventory_host(put, host, alice, role_field, expected_status_code) put(reverse('api:host_detail', kwargs={'pk': host.id}), data, alice, expect=expected_status_code) +@pytest.mark.django_db +def test_edit_inventory_host_with_limits(put, host, admin_user): + # The per-Organization host limits functionality should be a no-op on AWX. + inventory = host.inventory + inventory.organization.max_hosts = 1 + inventory.organization.save() + inventory.hosts.create(name='Alternate host') + + data = {'name': 'New name', 'description': 'Hello world'} + put(reverse('api:host_detail', kwargs={'pk': host.id}), data, admin_user, expect=200) + + @pytest.mark.parametrize("role_field,expected_status_code", [ (None, 403), ('admin_role', 204),