-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathstation_with_detail_and_location.feature
149 lines (143 loc) · 7.04 KB
/
station_with_detail_and_location.feature
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
Feature: Choose a station to start or end my itinerary according to its details and location.
In order to select a station
As a client software API
I need to be able to retrieve a list of station filterable by GeoLocation with their details and location.
@database
Scenario: Can Retrieve station list with their details and location.
Given a list of station:
| stationId | name | type | address | addressNumber | zipCode | latitude | longitude |
| 15cff96c-de06-4606-9870-b82eb9219339 | 08 - PG. PUJADES 2 | BIKE | Pg Lluis Companys | 2 | 08018 | 41.389088 | 2.183568 |
| 374c5b80-cb51-46d8-8f7d-48bce9044f23 | 492 - PL. TETUAN | ELECTRIC_BIKE | PL. DE TETUAN | 8-9 | 08010 | 41.394232 | 2.175278 |
When I add "Accept" header equal to "application/ld+json"
And I send a "GET" request to "/api/stations"
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
And the JSON should be equal to:
"""
{
"@context": "/api/contexts/station",
"@id": "/api/stations",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/api/stations/15cff96c-de06-4606-9870-b82eb9219339",
"@type": "station",
"id": "15cff96c-de06-4606-9870-b82eb9219339",
"name": "08 - PG. PUJADES 2",
"type": "BIKE",
"address": "Pg Lluis Companys",
"addressNumber": "2",
"zipCode": "08018",
"latitude": 41.389088,
"longitude": 2.183568
},
{
"@id": "/api/stations/374c5b80-cb51-46d8-8f7d-48bce9044f23",
"@type": "station",
"id": "374c5b80-cb51-46d8-8f7d-48bce9044f23",
"name": "492 - PL. TETUAN",
"type": "ELECTRIC_BIKE",
"address": "PL. DE TETUAN",
"addressNumber": "8-9",
"zipCode": "08010",
"latitude": 41.394232,
"longitude": 2.175278
}
]
}
"""
@database
Scenario: Can Retrieve station list with their details and location filtered by Geo location queries.
Given a list of station:
| stationId | name | type | address | addressNumber | zipCode | latitude | longitude |
| 15cff96c-de06-4606-9870-b82eb9219339 | 50 - AV. PARAL.LEL, 54 | BIKE | 50 - AV. PARAL.LEL, 54 | 2 | 08001 | 41.375 | 2.17035 |
| 374c5b80-cb51-46d8-8f7d-48bce9044f23 | 114 - PL. JEAN GENET, 1 | ELECTRIC_BIKE | Av. Paral.lel | 8-9 | 08001 | 41.376801 | 2.173039 |
| 02ec1e88-4c3d-4b3d-af0a-0d11eb4ce1ab | 352 - C/RADI, 10/GRAN VIA | BIKE | Radi | 8-9 | 08098 | 41.36335 | 2.134144 |
When I add "Accept" header equal to "application/ld+json"
And I send a "GET" request to "/api/stations?geo_location_filter=41.373,2.17031,800.00"
Then the response status code should be 200
And the JSON should be equal to:
"""
{
"@context": "/api/contexts/station",
"@id": "/api/stations",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/api/stations/15cff96c-de06-4606-9870-b82eb9219339",
"@type": "station",
"id": "15cff96c-de06-4606-9870-b82eb9219339",
"name": "50 - AV. PARAL.LEL, 54",
"type": "BIKE",
"address": "50 - AV. PARAL.LEL, 54",
"addressNumber": "2",
"zipCode": "08001",
"latitude": 41.375,
"longitude": 2.17035
},
{
"@id": "/api/stations/374c5b80-cb51-46d8-8f7d-48bce9044f23",
"@type": "station",
"id": "374c5b80-cb51-46d8-8f7d-48bce9044f23",
"name": "114 - PL. JEAN GENET, 1",
"type": "ELECTRIC_BIKE",
"address": "Av. Paral.lel",
"addressNumber": "8-9",
"zipCode": "08001",
"latitude": 41.376801,
"longitude": 2.173039
}
],
"hydra:view": {
"@id": "/api/stations?geo_location_filter=41.373%2C2.17031%2C800.00",
"@type": "hydra:PartialCollectionView"
}
}
"""
@database
Scenario: Can't Retrieve station list with their details and location with bad query parameters
Given a list of station:
| stationId | name | type | address | addressNumber | zipCode | latitude | longitude |
| 15cff96c-de06-4606-9870-b82eb9219339 | 50 - AV. PARAL.LEL, 54 | BIKE | 50 - AV. PARAL.LEL, 54 | 2 | 08001 | 41.375 | 2.17035 |
When I add "Accept" header equal to "application/ld+json"
And I send a "GET" request to "/api/stations?geo_location_filter=bad_query_type,2.17031,800.00"
Then the response status code should be 400
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@database
Scenario: Can Retrieve a station with its detail and location.
Given a list of station:
| stationId | name | type | address | addressNumber | zipCode | latitude | longitude |
| feb78515-1b8b-42fa-b8f4-da8f80b44733 | 08 - PG. PUJADES 2 | BIKE | Pg Lluis Companys | 2 | 08018 | 41.389088 | 2.183568 |
When I add "Accept" header equal to "application/ld+json"
And I send a "GET" request to "/api/stations/feb78515-1b8b-42fa-b8f4-da8f80b44733"
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
And the JSON should be equal to:
"""
{
"@context": "/api/contexts/station",
"@id": "/api/stations/feb78515-1b8b-42fa-b8f4-da8f80b44733",
"@type": "station",
"id": "feb78515-1b8b-42fa-b8f4-da8f80b44733",
"name": "08 - PG. PUJADES 2",
"type": "BIKE",
"address": "Pg Lluis Companys",
"addressNumber": "2",
"zipCode": "08018",
"latitude": 41.389088,
"longitude": 2.183568
}
"""
@database
Scenario: Can Not Retrieve a station with its detail and location that does not exists.
Given a list of station:
| stationId | name | type | address | addressNumber | zipCode | latitude | longitude |
| feb78515-1b8b-42fa-b8f4-da8f80b44733 | 08 - PG. PUJADES 2 | BIKE | Pg Lluis Companys | 2 | 08018 | 41.389088 | 2.183568 |
When I add "Accept" header equal to "application/ld+json"
And I send a "GET" request to "/api/stations/15cff96c-de06-4606-9870-b82eb9219339"
Then the response status code should be 404
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"