1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

more robust test mode checking

This commit is contained in:
Chris Meyers 2016-10-03 09:28:01 -04:00
parent 9b451076fc
commit 203df91a5d
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@
import sys
from django.db import models
from django.conf import settings
class HostManager(models.Manager):
@ -25,7 +26,7 @@ class InstanceManager(models.Manager):
def me(self):
"""Return the currently active instance."""
# If we are running unit tests, return a stub record.
if len(sys.argv) >= 2 and sys.argv[1] == 'test':
if settings.IS_TESTING(sys.argv):
return self.model(id=1,
hostname='localhost',
uuid='00000000-0000-0000-0000-000000000000')

View File

@ -30,6 +30,9 @@ def is_testing(argv=None):
return True
return False
def IS_TESTING(argv=None):
return is_testing(argv)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SQL_DEBUG = DEBUG