meta { name: Create Price Report type: http seq: 2 } post { url: {{baseUrl}}/products/{{productId}}/price_reports body: json } headers { Content-Type: application/json Authorization: Bearer {{authToken}} } body:json { { "price_report": { "price": "9.99", "discount_price": "7.99", "store_id": {{storeId}} } } } assert { res.status: equals 201 } script:post-response { const body = res.getBody(); if (body && body.id) { bru.setVar("priceReportId", body.id); } } tests { test("Create price report returns report object directly", function() { const data = res.getBody(); expect(data).to.have.property("id"); expect(data).to.have.property("price"); expect(data).to.have.property("discount_price"); expect(data).to.have.property("store_id"); expect(data).to.have.property("product_id"); expect(data).to.have.property("user_id"); expect(data).to.have.property("reported_at"); expect(data).to.have.property("created_at"); expect(data).to.have.property("updated_at"); }); test("Price report has correct values", function() { const data = res.getBody(); expect(data.product_id).to.equal(Number(bru.getVar("productId"))); expect(data.store_id).to.equal(Number(bru.getVar("storeId"))); }); }