Move the panel mocks to a separate method on TestCase
We need to remove the panel mocks in Tuskar-UI tests, because they import and register the admin panel as their side effect. To do that easily, I'm moving that part into a separate method. Partial-bug: #1384683 Change-Id: Ica366c0b9f680049a74e94007a563ffdb492e4f4
This commit is contained in:
parent
8a3bd01b55
commit
dece4cc345
@ -151,12 +151,16 @@ class TestCase(horizon_helpers.TestCase):
|
||||
middleware.HorizonMiddleware().process_request(self.request)
|
||||
AuthenticationMiddleware().process_request(self.request)
|
||||
self.patchers = {}
|
||||
self.add_panel_mocks()
|
||||
os.environ["HORIZON_TEST_RUN"] = "True"
|
||||
|
||||
def add_panel_mocks(self):
|
||||
"""Global mocks on panels that get called on all views."""
|
||||
self.patchers['aggregates'] = mock.patch(
|
||||
'openstack_dashboard.dashboards.admin'
|
||||
'.aggregates.panel.Aggregates.can_access',
|
||||
mock.Mock(return_value=True))
|
||||
self.patchers['aggregates'].start()
|
||||
os.environ["HORIZON_TEST_RUN"] = "True"
|
||||
|
||||
def tearDown(self):
|
||||
self.mox.UnsetStubs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user