mirror of
https://github.com/ansible/awx.git
synced 2026-09-04 19:08:30 -02:30
Fix how test database settings are passed to management commands for unit tests.
This commit is contained in:
@@ -42,6 +42,10 @@ class BaseTestMixin(object):
|
||||
if name == 'SERVER_URI':
|
||||
value = ''
|
||||
setattr(settings, 'AUTH_LDAP_%s' % name, value)
|
||||
# Pass test database settings in environment for use by any management
|
||||
# commands that run from tests.
|
||||
for opt in ('ENGINE', 'NAME', 'USER', 'PASSWORD', 'HOST', 'PORT'):
|
||||
os.environ['AWX_TEST_DATABASE_%s' % opt] = settings.DATABASES['default'][opt]
|
||||
|
||||
def tearDown(self):
|
||||
super(BaseTestMixin, self).tearDown()
|
||||
|
||||
@@ -954,9 +954,6 @@ class InventoryUpdatesTest(BaseTransactionTest):
|
||||
self.organization.users.add(self.normal_django_user)
|
||||
self.inventory = self.organization.inventories.create(name='Cloud Inventory')
|
||||
self.group = self.inventory.groups.create(name='Cloud Group')
|
||||
# Pass test database name in environment for use by the inventory_import
|
||||
# management command.
|
||||
os.environ['AWX_TEST_DATABASE_NAME'] = settings.DATABASES['default']['NAME']
|
||||
|
||||
def update_inventory_source(self, group, **kwargs):
|
||||
inventory_source = group.inventory_source
|
||||
|
||||
Reference in New Issue
Block a user