import requests from tests.integration import config def test_get_collaborator_applications( bearer_token_with_vendor_star, ows_account_test_user_settings_profile ): """GET /collaborator/{collaborator_uuid}/applications.""" response = requests.get( '{qa_base_url}/collaborator/{collaborator_uuid}/applications'.format( qa_base_url=config.QA_BASE_URL, collaborator_uuid='db622285-c164-4532-aaa1-566bcf391647' ), headers={ 'authorization': f'Bearer {bearer_token_with_vendor_star}', 'orchard-profile-type': ows_account_test_user_settings_profile.profile_type, 'orchard-profile-id': str(ows_account_test_user_settings_profile.profile_id), }, ) assert response.status_code == 200 expected_applications = [ { 'application_id': 'CUSTOMER_ACCOUNTING_APP', 'roles': ['CUSTOMER_ACCOUNTING_BASE_ROLE'], 'url': 'https://accounting.theorchard.com', }, { 'application_id': 'BANKING_TAX_APP', 'roles': ['BANKING_TAX_BASE_ROLE'], 'url': 'https://documents.theorchard.com', }, ] assert response.json().get('applications') == expected_applications def test_no_access(bearer_token_without_vendor_star): """GET /collaborator/{collaborator_uuid}/applications no access.""" response = requests.get( '{qa_base_url}/collaborator/{collaborator_uuid}/applications'.format( qa_base_url=config.QA_BASE_URL, collaborator_uuid='e1f85616-b4f0-444f-9a8f-731218cfd450' ), headers={ 'authorization': f'Bearer {bearer_token_without_vendor_star}', }, ) assert response.status_code == 403