def test_get_individual_response_field_wrong_field(self): response = { 'bill_to': '', 'init_request': '', 'short_description': 'PO 76069-14341 - 95032', 'total_cost': '0', 'due_by': '', 'description': '', 'requested_for': '', 'sys_updated_on': '2018-08-08 14:40:48', 'budget_number': '', 'u_received_cost': '0', 'u_business': '', 'number': 'PO0022269', 'sys_id': '0407cfa5dbb75b00fdd99257db9619e5', 'sys_updated_by': 'michael.rose', 'shipping': '', 'terms': '', 'sys_created_on': '2018-08-08 14:40:48', 'vendor': { 'link': 'https://iceuat.service-now.com/api/now/table/core_company/4407cfa5dbb75b00fdd99257db9619e3', 'value': '4407cfa5dbb75b00fdd99257db9619e3' }, 'sys_domain': { 'link': 'https://iceuat.service-now.com/api/now/table/sys_user_group/global', 'value': 'global' }, 'department': '', 'u_po_number': '76069-14341', 'sys_created_by': 'michael.rose', 'assigned_to': '', 'ordered': '', 'po_date': '7413-01-11 00:10:28', 'vendor_contract': '', 'contract': '', 'expected_delivery': '', 'sys_mod_count': '0', 'u_project': { 'link': 'https://iceuat.service-now.com/api/now/table/planned_task/02d1a2fa0f94fe809d486eb8b1050e86', 'value': '02d1a2fa0f94fe809d486eb8b1050e86' }, 'received': '', 'sys_tags': '', 'requested': '2018-08-08 04:00:00', 'requested_by': '', 'u_import_source': { 'link': 'https://iceuat.service-now.com/api/now/table/sys_import_set/e2f68fa5dbb75b00fdd99257db961950', 'value': 'e2f68fa5dbb75b00fdd99257db961950' }, 'ship_rate': '0', 'location': '', 'vendor_account': '', 'ship_to': '', 'status': 'ordered' } r = RESTQuery(query_table="proc_po", response=response) with pytest.raises(AssertionError) as e: r.get_individual_response_field("po_aint_got_no_field") assert "Field not found in response from proc_po: po_aint_got_no_field" in str( e)
def test_get_individual_response_field_no_response(self): r = RESTQuery() with pytest.raises(AssertionError) as e: r.get_individual_response_field("test_no_response") assert "Failed to retrieve data required for this test." in str(e)