Search code examples
javascriptpostmanpostman-collection-runner

how to pass this postman script test?


pm.test('get single collection', () => {
    pm.expect(error).to.equal(null);
    pm.expect(response).to.have.property('code', 200);
    pm.expect(response).to.have.property('status', 'OK');
    pm.expect(response.json().collection.auth.type, 'check collection authorization').to.equal("apikey")

get single workspace | AssertionError: expected { Object (id, _details, ...) } to have property 'code' of 200, but got 401

get single collection | AssertionError: expected { Object (id, _details, ...) } to have property 'code' of 200, but got 401

get single environment | AssertionError: expected { Object (id, _details, ...) } to have property 'code' of 200, but got 401


Solution

  • enter image description here You need to send Authorization details from the Authorization tab which you can see in the image below.