From b9bf2d8cc16b6f2236d7b22f689e8bd0c5267f71 Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Mon, 11 Feb 2019 10:55:03 -0600
Subject: [PATCH] Another bugfix to unit tests due to throttling

---
 gracedb/api/tests/utils.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gracedb/api/tests/utils.py b/gracedb/api/tests/utils.py
index eaad41c51..bef02a5db 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()
-- 
GitLab