Merge pull request #6314 from pandachris/master

BAEL-2731 Testing APIs with Postman
This commit is contained in:
Eric Martin 2019-02-22 22:41:22 -06:00 committed by GitHub
commit 8caf6bc78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 184 additions and 0 deletions

View File

@ -0,0 +1,184 @@
{
"info": {
"_postman_id": "9989b5be-13ba-4d22-8e43-d05dbf628e58",
"name": "foo API test",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "add a foo",
"event": [
{
"listen": "test",
"script": {
"id": "a01534dc-6fc7-4c54-ba1d-6bcf311e5836",
"exec": [
"pm.test(\"success status\", () => pm.response.to.be.success );",
"",
"pm.test(\"name is correct\", () => ",
" pm.expect(pm.response.json().name).to.equal(\"Transformers\"));",
"",
"pm.test(\"id was assigned\", () => ",
" pm.expect(pm.response.json().id).to.be.not.null );",
"",
"pm.variables.set(\"id\", pm.response.json().id);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Transformers\"\n}"
},
"url": {
"raw": "http://localhost:8082/spring-boot-rest/auth/foos",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"spring-boot-rest",
"auth",
"foos"
]
}
},
"response": []
},
{
"name": "get a foo",
"event": [
{
"listen": "test",
"script": {
"id": "03de440c-b483-4ab8-a11a-d0c99b349963",
"exec": [
"pm.test(\"success status\", () => pm.response.to.be.success );",
"",
"pm.test(\"name is correct\", () => ",
" pm.expect(pm.response.json().name).to.equal(\"Transformers\"));",
"",
"pm.test(\"id is correct\", () => ",
" pm.expect(pm.response.json().id).to.equal(pm.variables.get(\"id\")) );"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8082/spring-boot-rest/auth/foos/{{id}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"spring-boot-rest",
"auth",
"foos",
"{{id}}"
]
}
},
"response": []
},
{
"name": "delete a foo",
"event": [
{
"listen": "test",
"script": {
"id": "74c1bb0f-c06c-48b1-a545-459233541b14",
"exec": [
"pm.test(\"success status\", () => pm.response.to.be.success );"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8082/spring-boot-rest/auth/foos/{{id}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"spring-boot-rest",
"auth",
"foos",
"{{id}}"
]
}
},
"response": []
},
{
"name": "verify delete",
"event": [
{
"listen": "test",
"script": {
"id": "03de440c-b483-4ab8-a11a-d0c99b349963",
"exec": [
"pm.test(\"status is 500\", () => pm.response.to.have.status(500) );",
"",
"pm.test(\"no value present\", () => ",
" pm.expect(pm.response.json().cause).to.equal(\"No value present\"));"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8082/spring-boot-rest/auth/foos/{{id}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"spring-boot-rest",
"auth",
"foos",
"{{id}}"
]
}
},
"response": []
}
]
}