def test_create_invitations(self, testing_config, logger): """Test create invitation.""" load_data = get_test_data(testing_config.test_data['invitation']) input_data = json.dumps({ 'recipientEmail': load_data['recipientEmail'], 'sentDate': datetime.datetime.now().strftime('Y-%m-%d %H:%M:%S'), 'membership': [{ 'membershipType': 'ADMIN', 'orgId': testing_config.org_id }] }) call_url = f'{testing_config.auth_api_url}/invitations' logger.debug(f'[ACTION] Post {call_url} with {input_data}') response = requests.post(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}') response_json = response.json() testing_config.notification_id = response_json.get('id') testing_config.invitation_json = response_json
def test_admin_approve_invitation(self, tested_user, testing_config, logger): """Test admin user approve invitation.""" input_data = json.dumps( get_test_data(testing_config.test_data['member'])) for config in tested_user.config: token = config.keycloak_token testing_config.org_id = config.org_id call_url = f'{testing_config.auth_api_url}/orgs/{testing_config.org_id}/members?status=PENDING_APPROVAL' logger.debug(f'[ACTION] Get {call_url} with {input_data}') response = requests.get( call_url, headers={'Authorization': f'Bearer {token}'}) assert response.status_code == 200 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}') response_json = response.json() testing_config.member_id = response_json.get('members')[0]['id'] call_url = f'{testing_config.auth_api_url}/orgs/{testing_config.org_id}/members/{testing_config.member_id}' logger.debug(f'[ACTION] Patch {call_url} with {input_data}') response = requests.patch(call_url, headers={ 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 200 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}') break
def test_get_fees(self, testing_config, logger): """Test get fee.""" load_data = get_test_data(testing_config.test_data['fee_schedule']) call_url = f'{testing_config.pay_api_url}/fees/{load_data["corp_type_code"]}/{load_data["filing_type_code"]}' logger.debug(f'[ACTION] Get {call_url}') response = requests.get(call_url, headers={'Authorization': f'Bearer {testing_config.keycloak_token}'}) assert response.status_code == 200 logger.debug(f'[ACTION] Response: {response.status_code} {response.json()}')
def test_create_user_profile(self, testing_config, logger): """Test create user profile (contact information).""" input_data = json.dumps( get_test_data(testing_config.test_data['user_profile'])) response = requests.post( f'{testing_config.auth_api_url}/users/contacts', headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201
def test_create_affidavits(self, testing_config, logger): """Test create affidavits.""" org_data = get_test_data(testing_config.test_data['org']) address_data = get_test_data(testing_config.test_data['address']) input_data = json.dumps({ 'documentId': testing_config.document_key, 'issuer': org_data['name'], 'contact': address_data }) call_url = f'{testing_config.auth_api_url}/users/{testing_config.user_id}/affidavits' logger.debug(f'[ACTION] Post {call_url} with {input_data}') response = requests.post(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 200 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}')
def test_business_details(self, testing_config, logger): """Test get business details from legal api.""" input_data = get_test_data(testing_config.test_data['business']) call_url = f'{testing_config.legal_api_url}/businesses/{input_data["businessIdentifier"]}' logger.debug(f'[ACTION] Get {call_url}') response = requests.get(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}' }) assert response.status_code == 200 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}')
def test_create_account(self, testing_config, logger): """Test create account.""" input_data = json.dumps(get_test_data(testing_config.test_data['org'])) response = requests.post(f'{testing_config.auth_api_url}/orgs', headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201 response_json = response.json() testing_config.org_id = response_json.get('id')
def test_create_account(self, testing_config, logger): """Test create account.""" org_data = get_test_data(testing_config.test_data['org']) address_data = get_test_data(testing_config.test_data['address']) input_data = json.dumps({ 'name': org_data['name'], 'accessType': 'EXTRA_PROVINCIAL', 'mailingAddress': address_data }) call_url = f'{testing_config.auth_api_url}/orgs' logger.debug(f'[ACTION] Post {call_url} with {input_data}') response = requests.post(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}') response_json = response.json() testing_config.org_id = response_json.get('id')
def test_create_affiliation(self, testing_config, logger): """Test create affiliation.""" input_data = json.dumps( get_test_data(testing_config.test_data['business'])) call_url = f'{testing_config.auth_api_url}/orgs/{testing_config.org_id}/affiliations' logger.debug(f'[ACTION] Get {call_url} with {input_data}') response = requests.post(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}')
def test_create_user_profile(self, testing_config, logger): """Test create user profile (contact information).""" input_data = json.dumps( get_test_data(testing_config.test_data['user_profile'])) call_url = f'{testing_config.auth_api_url}/users/contacts' logger.debug(f'[ACTION] Post {call_url} with {input_data}') response = requests.post(call_url, headers={ 'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json' }, data=input_data) assert response.status_code == 201 logger.debug( f'[ACTION] Response: {response.status_code} {response.json()}')
def test_create_creditcard_payment(self, testing_config, logger): """Test creating creaditcard payment.""" load_data = get_test_data(testing_config.test_data['creditcard']) testing_config.payment_method = load_data['methodOfPayment'] input_data = json.dumps({ "paymentInfo": { "methodOfPayment": testing_config.payment_method }, "businessInfo": { "businessIdentifier": testing_config.business_identifier, "corpType": "CP", "businessName": "ABC Corp", "contactInfo": { "city": "Victoria", "postalCode": "V8P2P2", "province": "BC", "addressLine1": "100 Douglas Street", "country": "CA" } }, "filingInfo": { "filingTypes": [ { "filingTypeCode": "OTANN" } ] } }) call_url = f'{testing_config.pay_api_url}/payment-requests' logger.debug(f'[ACTION] Post {call_url} with {input_data}') response = requests.post(call_url, headers={'Authorization': f'Bearer {testing_config.keycloak_token}', 'Content-Type': 'application/json'}, data=input_data) assert response.status_code == 201 logger.debug(f'[ACTION] Response: {response.status_code} {response.json()}') response_json = response.json() testing_config.payment_id = response_json.get('id') testing_config.invoice_id = response_json.get('invoices')[0].get('id') testing_config.payment_method = load_data['methodOfPayment']