mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	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:
		@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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'):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user