"""Integration tests.""" import requests from tests.integration.consts import api def test_get_hello(): """Get Hello Endpoint.""" response = requests.get(api.HEALTH_CHECK) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'status' in response_body assert 'ok' in response_body['status'] def test_get_user_no_ad(users_url_path_with_token_no_ad): """Get User with no permsEndpoint.""" request = users_url_path_with_token_no_ad print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'UK Dice Recordings Music Limited' in response_body['company'] assert 'N' in response_body['permissions']['campaigns'] def test_get_user_write_ad(users_url_path_with_token_write_ad): """Get User with write perms Endpoint.""" request = users_url_path_with_token_write_ad print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'iota5' in response_body['company'] assert 'W' in response_body['permissions']['campaigns'] def test_get_artists(artists_url_path_with_token): """Get Artists Endpoint.""" request = artists_url_path_with_token print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'items' in response_body def test_get_artists_bulk(artists_url_path_with_token, body_bulk_request): """Get Artists bulk Endpoint.""" request = artists_url_path_with_token print(request) response = requests.post(request, data=body_bulk_request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'items' in response_body def test_get_artist(artist_url_path_with_token): """Get Artists Endpoint.""" request = artist_url_path_with_token print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'name' in response_body assert '161' in response_body['name'] def test_get_releases(releases_url_path_with_token): """Get Releases Endpoint.""" request = releases_url_path_with_token print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'items' in response_body def test_get_budget(budget_url_path_with_token): """Get Budget Endpoint.""" request = budget_url_path_with_token print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'monthly_total_budget' in response_body def test_get_budget_cap(budget_cap_url_path_with_token): """Get Budget Endpoint.""" request = budget_cap_url_path_with_token print(request) response = requests.get(request) assert response.status_code == 200, '\nReason: {}\nURL: {}'.format( response.reason, response.url) response_body = response.json() print(response_body) assert 'monthly_total_budget' in response_body['items'][0]