Fix py27 UT gate

1.Fix TypeError: 'Mock' object is not iterable error
2.import openstack_dashboard.test.settings

Change-Id: I9f2b640b1d58bc4f3f559458d9eed92c9594e686
This commit is contained in:
zhurong 2019-07-29 09:58:42 +08:00
parent e9ab1ead80
commit 3cb13c6c26
2 changed files with 2 additions and 5 deletions

View File

@ -18,11 +18,7 @@ DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test'}}
from horizon.test.settings import * # noqa
try:
from openstack_dashboard.defaults import * # noqa
except ImportError:
pass
from openstack_dashboard.test.settings import * # noqa
socket.setdefaulttimeout(1)

View File

@ -80,6 +80,7 @@ class TestEnvironmentDetails(unittest.TestCase):
mock_request = mock.Mock()
mock_request.user.service_catalog = None
mock_token = mock.MagicMock()
mock_request.user.authorized_tenants = [mock.Mock()]
mock_token.tenant.__getitem__.return_value = 'foo_tenant_id'
mock_request.session = {'token': mock_token}
mock_tab_group = mock.Mock()