/customers/:id/address_detail
doesn’t have the exact same structure.
In my last post I added this note.
NOTE: In this example, address_detail will have an extra embedded array with the customer address\es
The beginning of the response structure is the same though.
{
"data": {
"customer": [
{
"ID": 75,
"addPricelistID": 0,
"billToID": 0,
"buyinGroupID": 0,
"cardTypeID": 0,
"chainID": 0,
"commentID": 0,
"creditIndicatorID": 0,
"currencyID": 1,
"discountByValueID": 0,
"discountPromptPayID": 0,
"EFTInstitutionID": 0,
"finEdgedPricelistID": 0,
"finUncutPricelistID": 0,
"framePricelistID": 0,
"freightPricelistID": 0,
"GLAccountID": 0,
"invoiceCycleID": 0,
"languageID": 0,
"miscItemPricelistID": 0,
"OSPricelistID": 0,
"packagePricelistID": 0,
"payCycleID": 0,
"payingAgentID": 0,
"paymentTermsID": 1,
"priceListID": 16,
"prismPricelistID": 0,
"rxEdgedPricelistID": 0,
"rxUncutPricelistID": 0,
"salesRepID": 2,
"shippingMethodID": 0,
"shippingServerID": 0,
"shippingZoneID": 0,
"shipToID": 0,
"specialPriceListID": 0,
"specificEOMCodeID": 0,
"statementDiscountID": 0,
"stockLensPricelistID": 0,
"taxAuthorityID": 1,
"volumeDiscountID": 0,
"accountNumber": "11234",
"accountsEmailAddress": "",
"allowBackOrders": false,
"allowPartialShipping": false,
"balancingMethod": 0,
"cardExpiryMonth": 0,
"cardExpiryYear": 0,
"cardHolderName": "",
"cardNumber": "0",
"cardSecurityCode": 0,
"name": "Angela Suhail",
"dateCreated": "2018-06-07T01:00:00.000Z",
"defaultPaymentType": 0,
"detailedInvoice": false,
"discount": 0,
"discountEndDate": "",
"EFTAccount": "",
"EFTReference": "",
"EFTSortCode": "",
"emailDueReport": false,
"emailInvoice": false,
"emailOverdueReport": false,
"emailStatements": false,
"excludeFromReports": false,
"exportDeclaration": "",
"faxNumber": "",
"financeCharge": false,
"fixedCharge": false,
"fixedShippingCharge": 0,
"freeShippingIn": false,
"freeShippingOut": false,
"freightCharge": 0,
"freightCode": "",
"generalEmailAddress": "",
"groupByPackingSlip": false,
"hidePatientNameOnWIP": false,
"invoiceMethod": 0,
"isActive": false,
"isInternal": false,
"isLab": false,
"isPOMandatory": false,
"lastCycleInvoiceDate": "",
"lastCycleRun": "",
"linkedLab": 0,
"listID": "",
"patientMandatory": false,
"payByCard": false,
"payByEFT": false,
"phoneNumber": "",
"POMandatory": false,
"priceOrders": true,
"printByOriginator": false,
"pwd": "",
"pwdRequired": false,
"rxInvoicesToPrint": 1,
"salesTaxAltCode": "",
"salesTaxPrimaryCode": "",
"sendNotifications": false,
"sendWIPEmail": false,
"sendWIPFax": false,
"sendWIPReport": false,
"shipToCustomer": false,
"statementCycle": 0,
"statementDiscount": 0,
"stockInvoicesToPrint": 1,
"storeCode": "",
"superInvoicing": false,
"suppressPricingOnDoc": false,
"suppressPricingOnInv": false,
"taxExempNumber": "",
"taxRegNumber": "",
"useInvoiceCycles": false,
"usePayingAgent": false,
"volumeDiscount": false,
"WIPEmailAddress": "",
"WIPFaxNumber": "",
"WIPInternetAccess": false,
"WIPReportEndTime": "",
"WIPReportStartTime": "",
"createdBy": 0,
"updatedBy": 22,
"lastUpdated": "2020-01-12T16:50:24.496Z",
"addresses": [ **//This is the extra array**
{
"ID": 75,
"countryID": 0,
"countyID": 0,
"customerID": 75,
"regionID": 0,
"addressType": 7,
"externalID": "",
"line1": "",
"line2": "",
"line3": "",
"locality": "",
"postcode": "",
"createdBy": 0,
"updatedBy": 0,
"lastUpdated": "2018-06-07T17:06:51.135Z"
}
]
}
]
}
}
So when I’m testing, I can still test multiple requests with this test.
const jsonData = pm.response.json();
pm.test("Customers smoke test", () => {
pm.expect(jsonData.data.customer).to.be.an("array");
pm.expect(jsonData.data.customer[0]).to.be.an("object");
pm.expect(jsonData.data.customer[0]).to.have.property("ID");
pm.expect(jsonData.data.customer[0]).to.have.property("billToID");
pm.expect(jsonData.data.customer[0]).to.have.property("name");
});
To test the customer address array, I guess I’d have to add a conditional to that test so IF there’s a an array called “addresses” it checks for properties in that array.
"addresses": [ **//This is the extra array**
{
"ID": 75,
"countryID": 0,
"countyID": 0,
//...
That way I could smoke tests 3 requests with one code block.
I’m not sure if doing that is good\bad or unimportant. It is a basic smoke test.