-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo-App-Collection.postman_collection.json
127 lines (127 loc) · 3.66 KB
/
Demo-App-Collection.postman_collection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
"info": {
"name": "Demo App Collection",
"_postman_id": "00d7cccf-46ca-45eb-6f5e-5258bd86bb82",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Calculate price for valid source and destination",
"event": [
{
"listen": "test",
"script": {
"id": "af837e12-3e71-4bf9-ac35-6dc5de94bd0a",
"type": "text/javascript",
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.test(\"Validate response content for source street\", function () {",
" pm.expect(jsonData.source.street).to.contain(\"Virchowstraße\");",
"});",
" ",
"pm.test(\"Validate response content for destination street\", function() {",
" pm.expect(jsonData.destination.street).to.contain(\"Goethestraße\");",
"});",
"",
"pm.test(\"Validate response content for distance in Kilometer to be above 1\", function() {",
" pm.expect(jsonData.driving.distanceInKilometer).to.be.above(1);",
"});",
"",
"pm.test(\"Validate response content for duration to be above 5 minuntes\", function() {",
" pm.expect(jsonData.driving.durationInMinutes).to.be.above(5);",
"});",
"",
"pm.test(\"Validate response content for price to be 27 Euro\", function() {",
" var price = Math.trunc(jsonData.price);",
" pm.expect(price).to.be.equal(27);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"source\": {\n\t\t\"street\": \"Virchowstraße 167a\",\n\t\t\"zipCode\": \"45147\",\n\t\t\"city\": \"Essen\",\n\t\t\"country\": \"de\"\n\t},\n\t\"destination\": {\n\t\t\"street\": \"Goethestraße 41\",\n\t\t\"zipCode\": \"45128\",\n\t\t\"city\": \"Essen\",\n\t\t\"country\": \"de\"\n\t}\n}"
},
"url": {
"raw": "{{url}}/api/pricing",
"host": [
"{{url}}"
],
"path": [
"api",
"pricing"
]
},
"description": ""
},
"response": []
},
{
"name": "Fail to calculate price because locations not exist",
"event": [
{
"listen": "test",
"script": {
"id": "0bfa8a4d-2df1-4a90-9a45-49efff76f6fe",
"type": "text/javascript",
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.test(\"Request is failed with status code 404\", function () {",
" pm.response.to.have.status(404);",
"});",
"",
"pm.test(\"Validate response content to contain failure message\", function () {",
" pm.expect(jsonData.message).to.equals(\"No pricing available for the specified source and destination!\");",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"source\": {\n\t\t\"street\": \"Entenhausenstraße 100000\",\n\t\t\"zipCode\": \"45147\",\n\t\t\"city\": \"Essen\",\n\t\t\"country\": \"de\"\n\t},\n\t\"destination\": {\n\t\t\"street\": \"Tor zur Hölle\",\n\t\t\"zipCode\": \"45128\",\n\t\t\"city\": \"Essen\",\n\t\t\"country\": \"de\"\n\t}\n}"
},
"url": {
"raw": "{{url}}/api/pricing",
"host": [
"{{url}}"
],
"path": [
"api",
"pricing"
]
},
"description": ""
},
"response": []
}
],
"variable": [
{
"id": "7c36e4cc-2109-4bd4-a2c3-ac45189d343d",
"key": "url",
"value": "https://demo-master.home.koudingspawn.de",
"type": "text"
}
]
}