629 lines
12 KiB
JSON
629 lines
12 KiB
JSON
{
|
|
"info": {
|
|
"_postman_id": "bc2a9f01-c583-47e6-b911-69f399bd30a4",
|
|
"name": "inventory",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
},
|
|
"item": [
|
|
{
|
|
"name": "create inventory",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "661c9fbf-3f52-4256-9220-8d32cbfda581",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"//postman.clearEnvironmentVariable(\"inv\");",
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"tests[\"status code is 200\"] == responseCode.code === 200;"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "inventory",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "3f46c773-6962-484e-9029-66487ceb1eff",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['json'] = jsonData == \"my_inv\";",
|
|
"",
|
|
"tests[\"inv good\"] = responseBody == '[\"my_inv\"]';",
|
|
"tests[\"content type\"] = postman.getResponseHeader('Content-Type') === 'application/json';",
|
|
"",
|
|
"postman.setEnvironmentVariable(\"inv\", jsonData);",
|
|
"tests[\"Body is object\"] = typeof jsonData == \"object\";"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "{{url}}/api/inventories",
|
|
"host": [
|
|
"{{url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"inventories"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "group create",
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/{{inv}}/groups/first_group",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"{{inv}}",
|
|
"groups",
|
|
"first_group"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "group create child",
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/my_child",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"my_child"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "groups",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "{{url}}/api/inventory/my_inv/groups/",
|
|
"host": [
|
|
"{{url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
""
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "vars",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/vars",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"vars"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "vars create",
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/vars/my_var",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"vars",
|
|
"my_var"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "children",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/children",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"children"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "children create",
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/children/my_child",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"children",
|
|
"my_child"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "hosts",
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/hosts",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"hosts"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "hosts create",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "040fd106-e290-4c49-86ee-fb1dd3c24dfd",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"",
|
|
"tests[\"response\"] = responseBody.has(\"detail\");",
|
|
"",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['json'] = jsonData[\"detail\"] == \"Not found.\";"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/hosts/my_host",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"hosts",
|
|
"my_host"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "machine create",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "6c3f2287-161c-42b3-9280-c10cfd2aa9af",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['json'] = jsonData[\"status\"] == \"ADD\"; jsonData[\"details\"] == \"machine\"; "
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/machines/my_machine",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"machines",
|
|
"my_machine"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "machine delete",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "05ae09d7-d687-4027-a6aa-c906a0889242",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['response'] = jsonData[\"status\"] == \"delete\"; jsonData[\"details\"] == \"machine\"; ",
|
|
"",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "{{url}}/api/machines/my_machine",
|
|
"host": [
|
|
"{{url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"machines",
|
|
"my_machine"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "hosts create successfully",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "c73220fb-c363-4672-bb25-2d171c4f204f",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['json'] = jsonData[\"status\"] == \"ADD\"; jsonData[\"details\"] == \"host\"; "
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv/groups/first_group/hosts/my_machine",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv",
|
|
"groups",
|
|
"first_group",
|
|
"hosts",
|
|
"my_machine"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "get inventory json",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "80ef89ad-c979-4fdf-941a-ae9bce482c44",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
|
|
"tests[\"status code is 200\"] == responseCode.code === 200;",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests[\"Response contains 'all'\"] = responseBody.has(\"all\");"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "{{url}}/api/inventory/my_inv",
|
|
"host": [
|
|
"{{url}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "delete inventory",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"id": "4acda595-ed90-4b19-85ec-c22c74296bc1",
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"postman.clearEnvironmentVariable(\"inv\");",
|
|
"",
|
|
"tests[\"status code is 200\"] == responseCode.code === 200;",
|
|
"var jsonData = JSON.parse(responseBody);",
|
|
"tests['json'] = jsonData[\"status\"] == \"DELETE\"; jsonData[\"details\"] == \"inventory\";"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "X-Auth-Token",
|
|
"value": "c7ddde9d507837a770161779f8debdab91e70344731a0bd148741d98c94d9691"
|
|
}
|
|
],
|
|
"body": {},
|
|
"url": {
|
|
"raw": "http://127.0.0.1:8000/api/inventory/my_inv",
|
|
"protocol": "http",
|
|
"host": [
|
|
"127",
|
|
"0",
|
|
"0",
|
|
"1"
|
|
],
|
|
"port": "8000",
|
|
"path": [
|
|
"api",
|
|
"inventory",
|
|
"my_inv"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
} |