mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
flake8
This commit is contained in:
parent
b4c0d2b3b3
commit
d9d9d589b0
@ -5,15 +5,25 @@ import mock
|
||||
|
||||
# Django
|
||||
from django.test import SimpleTestCase
|
||||
from django.conf import settings
|
||||
|
||||
# AWX
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.ha import * # noqa
|
||||
from awx.main.tests.base import BaseTest
|
||||
|
||||
__all__ = ['HAUnitTest',]
|
||||
|
||||
TEST_LOCALHOST = {
|
||||
'HOST': 'localhost'
|
||||
}
|
||||
|
||||
TEST_127_0_0_1 = {
|
||||
'HOST': '127.0.0.1'
|
||||
}
|
||||
|
||||
TEST_FILE = {
|
||||
'HOST': '/i/might/be/a/file',
|
||||
}
|
||||
|
||||
class HAUnitTest(SimpleTestCase):
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=2)
|
||||
@ -21,16 +31,16 @@ class HAUnitTest(SimpleTestCase):
|
||||
self.assertTrue(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': 'localhost' })
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', TEST_LOCALHOST)
|
||||
def test_db_localhost(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': '127.0.0.1' })
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', TEST_127_0_0_1)
|
||||
def test_db_127_0_0_1(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
|
||||
@mock.patch('awx.main.models.Instance.objects.count', return_value=1)
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', { 'HOST': '/i/might/be/a/file' })
|
||||
@mock.patch.dict('django.conf.settings.DATABASES', TEST_FILE)
|
||||
def test_db_file_socket(self, ignore):
|
||||
self.assertFalse(is_ha_environment())
|
||||
|
Loading…
Reference in New Issue
Block a user