"""Test the GET /identity/admin/profiles endpoint.""" import requests from tests.integration import config, utils def test_get_vendor_star_admin_profiles(bearer_token_user_with_vendor_star): """Test getting profiles of a vendor star admin.""" response = requests.get( f'{config.QA_BASE_URL}/identity/admin/profiles?term=test-user', headers={ 'Authorization': f'Bearer {bearer_token_user_with_vendor_star}', 'Orchard-Profile-Type': 'SettingsProfile', 'Orchard-Profile-Id': utils.OWS_ACCOUNT_TEST_USER_SETTINGS_PROFILE_ID, 'Orchard-Identity-Id': utils.OWS_ACCOUNT_TEST_USER_ID, }, ) assert response.status_code == 200 assert any( user for user in response.json()['items'] if user['id'] == 'f3a4db1b-3556-4658-85fd-2f9676dab588' and user['email'] == 'test-user@theorchard.io' ) def test_get_non_vendor_star_admin_profiles(bearer_token): """Test getting profiles of a non vendor star admin.""" # Calling as PDP test user, who has admin access to Test Label. response = requests.get( f'{config.QA_BASE_URL}/identity/admin/profiles', params={ 'limit': 500, # This is brittle. The test should paginate }, headers={ 'Authorization': f'Bearer {bearer_token}', 'Orchard-Profile-Type': 'SettingsProfile', 'Orchard-Profile-Id': utils.PDP_TEST_USER_SETTINGS_PROFILE_ID, 'Orchard-Identity-Id': utils.PDP_TEST_USER_ID, }, ) assert response.status_code == 200 # Check that this user, who has collaborators access to Test Label, is there assert any( user for user in response.json()['items'] if user['id'] == utils.NO_SETTINGS_USER_ID and user['email'] == utils.OWS_PERMISSIONS_NO_SETTINGS_TEST_USER )