test: remove unrelated inventory test changes

This commit is contained in:
akus062381
2026-10-29 10:30:17 -04:00
parent 1582b03ff6
commit cdb5c5b58d
@@ -4,7 +4,7 @@ import pytest
from unittest import mock from unittest import mock
# AWX # AWX
from awx.main.models import Host, Inventory, InventorySource, InventoryUpdate, CredentialType, Credential, Job, Organization from awx.main.models import Host, Inventory, InventorySource, InventoryUpdate, CredentialType, Credential, Job
from awx.main.utils.filters import SmartFilter from awx.main.utils.filters import SmartFilter
from awx.main.utils.plugins import discover_available_cloud_provider_plugin_names from awx.main.utils.plugins import discover_available_cloud_provider_plugin_names
@@ -385,40 +385,3 @@ class TestHostManager:
# 2 organizations with host of same name only has 1 entry in smart inventory # 2 organizations with host of same name only has 1 entry in smart inventory
# smart inventory in 1 organization does not include host from another # smart inventory in 1 organization does not include host from another
# smart inventory correctly returns hosts in filter in same organization # smart inventory correctly returns hosts in filter in same organization
@pytest.mark.django_db
class TestInventorySourceOrganization:
"""An inventory source can't set its organization; it follows its inventory's."""
def test_new_source_takes_inventory_organization(self, inventory):
source = inventory.inventory_sources.create(name='source', source='ec2')
assert source.organization_id == inventory.organization_id
def test_moving_inventory_moves_its_sources(self, inventory, inventory_source):
other = Organization.objects.create(name='other-org')
inventory.organization = other
inventory.save()
inventory_source.refresh_from_db()
assert inventory_source.organization_id == other.id
def test_inventory_updates_carry_the_new_organization(self, inventory, inventory_source):
other = Organization.objects.create(name='other-org')
inventory.organization = other
inventory.save()
inventory_source.refresh_from_db()
assert inventory_source.create_unified_job().organization_id == other.id
def test_save_repairs_a_source_left_behind(self, inventory, inventory_source):
other = Organization.objects.create(name='other-org')
InventorySource.objects.filter(pk=inventory_source.pk).update(organization=other)
inventory.save()
inventory_source.refresh_from_db()
assert inventory_source.organization_id == inventory.organization_id
def test_partial_save_without_organization_leaves_sources_alone(self, inventory, inventory_source):
other = Organization.objects.create(name='other-org')
InventorySource.objects.filter(pk=inventory_source.pk).update(organization=other)
inventory.save(update_fields=['description'])
inventory_source.refresh_from_db()
assert inventory_source.organization_id == other.id