def test_https_request_basic(get_patch): res_patch = mock.Mock(spec=requests.Response) res_patch.status_code = 200 get_patch.return_value = res_patch api = API() api._set_auth("account_id", "username", "password") res = api.https_request("a real url", "get", {"test": 1})
def test_https_request_too_many(get_patch): res_patch = mock.Mock(spec=requests.Response) res_patch.status_code = 429 res_patch.content = "{'message': 'testing'}" get_patch.return_value = res_patch api = API() api._set_auth("account_id", "username", "password") res = api.https_request("a real url", "get", {"test": 1})