class ApiTest(IntegrationTest): def setUp(self): self.new_api = Api(sandbox_mode=True) def test_good_request(self): response = self.new_api.request('/games', 'get') self.assertEqual(response.status_code, 200)
class ApiTest(IntegrationTest): def setUp(self): self.new_api = Api() def test_good_request(self): response = self.new_api.request('/account', 'get') self.assertEqual(response.status_code, 200)
def test_request_with_auth_params(mocker): mocker.patch("mkmsdk.api.request") api = Api("https://sandbox.cardmarket.com/ws/v1.1/output.json") mocker.patch.object(api, 'create_auth') mocker.patch.object(api, 'handle_response') auth_params = { "app_token": "my_app_token", "app_secret": "my_app_secret", "access_token": "my_access_token", "access_token_secret": "my_access_token_secret" } api.request("/games", "get", auth_params=auth_params) api.create_auth.assert_called_with( "https://sandbox.cardmarket.com/ws/v1.1/output.json/games", app_token="my_app_token", app_secret="my_app_secret", access_token="my_access_token", access_token_secret="my_access_token_secret")
def test_good_request(): """Verifies that a correctly formed api request returns 200.""" new_api = Api(_API_MAP["1.1"]["api_sandbox_root"]) response = new_api.request("/games", "get") assert response.status_code == 200
def test_good_request(): """Verifies that a correctly formed api request returns 200.""" new_api = Api(sandbox_mode=True) response = new_api.request('/games', 'get') assert response.status_code == 200