"""Integration tests for ows-accounting: reports -> physical.""" from tests.integration import conftest from tests.integration.conftest import get_file_type_txt, \ get_format_es_es, get_period, get_periods, \ get_transaction_types_physical, \ label_18805, label_7482, subaccount_13823, user_headers def test_quarterly_user(clean_physical_reports): """POST /report should create a new physical report for quarterly user""" test_user = label_7482() params = {'file_type': get_file_type_txt(), 'number_format': get_format_es_es(), 'transaction_types': get_transaction_types_physical(), 'periods': get_periods(), 'request_context': {'first_name': 'Chris', 'last_name': 'Wilson', 'contact_id': test_user['id'], 'contact_email': 'QAORCHEmailContact@theorchard.com' } } headers = user_headers( test_user['user_type'], test_user['id'], test_user['vend_contact_id']) ows_accounting_client = conftest.ows_accounting_api_client(headers) results = ows_accounting_client.post_report(params) json_results = results.json() assert results.status_code == 200, \ 'Result of call was {}, expected 200.'.format(results.status_code) assert json_results['message'] == '200 Created' def test_monthly_user(clean_physical_reports): """POST /report should create a new physical report for monthly user""" test_user = label_18805() params = {'file_type': get_file_type_txt(), 'number_format': get_format_es_es(), 'transaction_types': get_transaction_types_physical(), 'periods': get_period(), 'request_context': {'first_name': 'Rico', 'last_name': 'Micallef', 'contact_id': test_user['id'], 'contact_email': 'master.rights@theorchard.com' } } headers = user_headers( test_user['user_type'], test_user['id'], test_user['vend_contact_id']) ows_accounting_client = conftest.ows_accounting_api_client(headers) results = ows_accounting_client.post_report(params) json_results = results.json() assert results.status_code == 200, \ 'Result of call was {}, expected 200.'.format(results.status_code) assert json_results['message'] == '200 Created' def test_subaccount_user(clean_physical_reports): """POST /report should create a new physical report for subaccount""" test_user = subaccount_13823() params = {'file_type': get_file_type_txt(), 'number_format': get_format_es_es(), 'transaction_types': get_transaction_types_physical(), 'periods': get_period(), 'request_context': {'first_name': 'Alec', 'last_name': 'Harris', 'contact_id': test_user['id'], 'contact_email': 'QAORCHEmailContact@theorchard.com' } } headers = user_headers( test_user['user_type'], test_user['id'], test_user['vend_contact_id']) ows_accounting_client = conftest.ows_accounting_api_client(headers) results = ows_accounting_client.post_report(params) json_results = results.json() assert results.status_code == 200, \ 'Result of call was {}, expected 200.'.format(results.status_code) assert json_results['message'] == '200 Created'