Don't reset the context twice.
@@ -111,8 +111,11 @@ class BaseFunctionalTest(DbTestCase):
def tearDown(self):
super(BaseFunctionalTest, self).tearDown()
+ # Reset mock context for API requests
if getattr(self, 'request_context_mock', None):
self.request_context_mock.stop()
+
+ if hasattr(Router, 'mock_context'):
del(Router.mock_context)
@classmethod
@@ -201,10 +204,3 @@ class BaseAPIControllerWithRBACTestCase(BaseFunctionalTest, CleanDbTestCase):
user=user_2_db.name, role=SystemRole.ADMIN,
source='assignments/%s.yaml' % user_2_db.name)
UserRoleAssignment.add_or_update(role_assignment_db)
-
- def tearDown(self):
- super(BaseAPIControllerWithRBACTestCase, self).tearDown()
-
- if getattr(self, 'request_context_mock', None):
- self.request_context_mock.stop()
- del(Router.mock_context)
