"""Integration tests for associated labels endpoints.""" import pytest import requests from tests.integration import config, utils START_ACCESS_ADMIN = { # tester@settingstesting.com 'identity_id': 'cabc0fe4-0cbf-4ce1-b750-130f22bcd8d7', 'profile_type': 'InsightsProfile', 'profile_id': 36036, } @pytest.fixture def headers(): """Get grass headers for admin access.""" return utils.convert_to_grass_headers( identity_id=START_ACCESS_ADMIN['identity_id'], profile_type=START_ACCESS_ADMIN['profile_type'], profile_id=START_ACCESS_ADMIN['profile_id'], ) def test_get_all_resources_for_profile(headers): """Test admin has access to all vendor resources.""" response = requests.get( f'{config.QA_BASE_URL}/admin/profile-type/{START_ACCESS_ADMIN["profile_type"]}' f'/profile/{START_ACCESS_ADMIN["profile_id"]}/resource/all', headers=headers, ) assert response.status_code == 200 items = response.json()['items'] vendor_star = next(item for item in items if item['id'] == '*') assert vendor_star is not None assert vendor_star['type'] == 'Vendor' def test_get_valid_label_name(headers): """Test getting valid label name for Myrna LabelParticipant.""" response = requests.get( f'{config.QA_BASE_URL}/associated-labels/LabelParticipant/950814', headers=headers ) assert response.status_code == 200 data = response.json() assert data['name'] == 'Kitty Wizard Records, LLC' assert data['vendorId'] == 32387 assert data['isDistributor'] == 'N' assert data['id'] == 32387 assert data['type'] == 'Vendor' def test_get_invalid_label_participant(headers): """Test getting null for invalid LabelParticipant.""" response = requests.get( f'{config.QA_BASE_URL}/associated-labels/LabelParticipant/1223343453454545', headers=headers ) assert response.status_code == 404