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:
parent
9b451076fc
commit
203df91a5d
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user