$kind: http-request
url: "{{csmisUrl}}/marketing/special-products-prices"
method: GET
headers:
  cooperativeApiToken: "{{COOPERATIVEAPITOKEN}}"
auth:
  type: oauth2
  credentials:
    client_authentication: header
    clientId: "{{UnionClientID}}"
    clientSecret: "{{UnionClientSecret}}"
    accessTokenUrl: "{{csmisAuthUrl}}"
    scope: write
    grant_type: client_credentials
    tokenName: csmis-token
    addTokenTo: header
scripts:
  - type: afterResponse
    code: >-
      pm.test("Response status code is 404", function () {
        pm.expect(pm.response.code).to.equal(404);
      });



      pm.test("Content-Type header is application/json", function () {
          pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
      });



      pm.test("Response has the required fields", function () {
          const responseData = pm.response.json();
          
          pm.expect(responseData).to.be.an('object');
          pm.expect(responseData.timestamp).to.exist;
          pm.expect(responseData.status).to.exist;
          pm.expect(responseData.error).to.exist;
          pm.expect(responseData.message).to.exist;
          pm.expect(responseData.path).to.exist;
      });



      pm.test("Timestamp is in a valid date format", function () {
          const responseData = pm.response.json();
          
          pm.expect(responseData.timestamp).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/);
      });



      pm.test("Error message is not empty", function () {
          const responseData = pm.response.json();
          
          pm.expect(responseData.error).to.exist.and.to.not.be.empty;
      });
    language: text/javascript
order: 2000
