def test_make_request_post(self, mock_requests): expected_headers = { "User-Agent": "Southwest/4.9.1 CFNetwork/887 Darwin/17.0.0", "Content-Type": "application/vnd.swacorp.com.mobile.boarding-passes-v1.0+json", "X-Api-Key": swa.API_KEY, "Accept-Language": "en-US;q=1" } expected_url = "https://api-extensions.southwest.com/v1/mobile/foo/123456/bar" fake_data = {} _ = swa._make_request( # NOQA "/foo/123456/bar", fake_data, content_type= "application/vnd.swacorp.com.mobile.boarding-passes-v1.0+json") mock_requests.post.assert_called_with(expected_url, json=fake_data, headers=expected_headers, verify=False)
def test_make_request_invalid_method(self, mock_requests): with self.assertRaises(AssertionError): swa._make_request("/foo/123456/bar", {}, "application/json", method="foo")