Fix up unit tests for tracking system_uuid in the settings and database

This commit is contained in:
Matthew Jones
2014-11-17 14:14:07 -05:00
parent e99466efc2
commit eae8c48faa
12 changed files with 18 additions and 2 deletions

View File

@@ -69,6 +69,9 @@ class BaseTestMixin(object):
os.environ['AWX_TEST_DATABASE_%s' % opt] = settings.DATABASES['default'][opt]
# Set flag so that task chain works with unit tests.
settings.CELERY_UNIT_TEST = True
settings.SYSTEM_UUID='00000000-0000-0000-0000-000000000000'
settings.BROKER_URL='redis://localhost:16379/'
# Create unique random consumer and queue ports for zeromq callback.
if settings.CALLBACK_CONSUMER_PORT:
callback_port = random.randint(55700, 55799)
@@ -214,6 +217,10 @@ class BaseTestMixin(object):
))
return results
def setup_instances(self):
instance = Instance(uuid=settings.SYSTEM_UUID, primary=True, ip_address='127.0.0.1')
instance.save()
def setup_users(self, just_super_user=False):
# Create a user.
self.super_username = 'admin'
@@ -479,8 +486,6 @@ class BaseTestMixin(object):
self.redis_process = None
@override_settings(SYSTEM_UUID='00000000-0000-0000-0000-000000000000',
BROKER_URL='redis://localhost:16379/')
class BaseTest(BaseTestMixin, django.test.TestCase):
'''
Base class for unit tests.