Created
March 22, 2018 13:05
-
-
Save safaorhan/23998f580c3dd4ac278a81d297c82e80 to your computer and use it in GitHub Desktop.
GET /customer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//status code is 200 | |
pm.test("Status code is 200", function () { | |
pm.response.to.have.status(200); | |
}); | |
//reponse body is json() | |
pm.test("Response body should be json",function(){ | |
pm.response.to.have.jsonBody(); | |
}) | |
var body = pm.response.json(); | |
var id = pm.environment.get("CUSTOMER_ID"); | |
var email = pm.environment.get("CUSTOMER_EMAIL"); | |
var firstName = pm.environment.get("CUSTOMER_FIRST_NAME"); | |
var lastName = pm.environment.get("CUSTOMER_LAST_NAME"); | |
var schema = { | |
type: "object", | |
properties: { | |
id: { | |
type: "integer", | |
minimum: id, | |
maximum: id | |
}, | |
createdDate: { | |
type: "string" | |
}, | |
firstName: { | |
type: "string", | |
pattern: firstName | |
}, | |
lastname: { | |
type: "string", | |
pattern: lastName | |
}, | |
email: { | |
type: "string", | |
pattern: email | |
} | |
} | |
}; | |
pm.test("Schema and values are valid ",function(){ | |
pm.expect(tv4.validate(body, schema)).to.be.true; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment