diff --git a/gracedb/api/tests/utils.py b/gracedb/api/tests/utils.py index eaad41c519637089560d2a9d1f52f77c78020781..bef02a5db0d70d1c4214677a02a29430e8bbf48e 100644 --- a/gracedb/api/tests/utils.py +++ b/gracedb/api/tests/utils.py @@ -27,17 +27,25 @@ def fix_settings(key, value): return api_settings -@mock.patch('api.throttling.BurstAnonRateThrottle.get_rate', - return_value='1000/second' -) @override_settings( ALLOW_BLANK_USER_AGENT_TO_API=True, ) class GraceDbApiTestBase(GraceDbTestBase): client_class = APIClient + def setUp(self): + super(GraceDbApiTestBase, self).setUp() + # Patch throttle and start patcher + self.patcher = mock.patch('api.throttling.BurstAnonRateThrottle.get_rate', + return_value='1000/second') + self.patcher.start() + + def tearDown(self): super(GraceDbApiTestBase, self).tearDown() # Clear throttle cache caches['throttles'].clear() + + # Stop patcher + self.patcher.stop()