@@ -9,4 +9,4 @@ Scott Nixon
|
||||
Jason Dorweiler
|
||||
Pierre-Alain Dupont
|
||||
Karl Goetz
|
||||
|
||||
Alex Kerney
|
||||
|
||||
@@ -1350,12 +1350,13 @@ class DiscourseClient(object):
|
||||
dictionary of response body data or None
|
||||
|
||||
"""
|
||||
params["api_key"] = self.api_key
|
||||
if "api_username" not in params:
|
||||
params["api_username"] = self.api_username
|
||||
url = self.host + path
|
||||
|
||||
headers = {"Accept": "application/json; charset=utf-8"}
|
||||
headers = {
|
||||
"Accept": "application/json; charset=utf-8",
|
||||
"Api-Key": self.api_key,
|
||||
"Api-Username": self.api_username,
|
||||
}
|
||||
|
||||
# How many times should we retry if rate limited
|
||||
retry_count = 4
|
||||
|
||||
@@ -49,12 +49,12 @@ class ClientBaseTestCase(unittest.TestCase):
|
||||
self.assertEqual(args[0], verb)
|
||||
self.assertEqual(args[1], self.host + url)
|
||||
|
||||
kwargs = kwargs["params"]
|
||||
self.assertEqual(kwargs.pop("api_username"), self.api_username)
|
||||
self.assertEqual(kwargs.pop("api_key"), self.api_key)
|
||||
headers = kwargs["headers"]
|
||||
self.assertEqual(headers.pop("Api-Username"), self.api_username)
|
||||
self.assertEqual(headers.pop("Api-Key"), self.api_key)
|
||||
|
||||
if verb == "GET":
|
||||
self.assertEqual(kwargs, params)
|
||||
self.assertEqual(kwargs["params"], params)
|
||||
|
||||
|
||||
class TestClientRequests(ClientBaseTestCase):
|
||||
|
||||
Reference in New Issue
Block a user