zoom: Fix handling of 201 status codes from zoom API.

Apparently, zoom's API will (sometimes?) return a 201 (not 200)
created in response to the API request to create a call.  We fix this
by using the proper requests check for whether or not the request
failed.
This commit is contained in:
Tim Abbott 2019-01-16 15:25:22 -08:00
parent 7824ce32a0
commit 1660856bf5
2 changed files with 7 additions and 1 deletions

View File

@ -18,7 +18,9 @@ def request_zoom_video_call_url(user_id: str, api_key: str, api_secret: str) ->
json = {}
)
if response.status_code != 200:
try:
response.raise_for_status()
except Exception:
return None
return response.json()

View File

@ -31,9 +31,13 @@ class TestFeedbackBot(ZulipTestCase):
def json(self) -> Dict[str, str]:
return {"join_url": "example.com"}
def raise_for_status(self) -> None:
return None
with mock.patch('requests.post', return_value=MockResponse()):
result = self.client_get("/json/calls/create")
self.assert_json_success(result)
self.assertEqual(result.status_code, 200)
def test_create_video_request(self) -> None:
with mock.patch('requests.post'):