Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scenario: Can't view Rides list without authentication
- When I send a "GET" request to "/api/users/rides"
- Then the response code should be 401
- Failed asserting that 404 is identical to 401.
- *******************************
- Scenario: Can view Rides list
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "GET" request to "/api/users/rides"
- Then the response code should be 200
- And the response should contain json:
- """
- {
- "meta": {
- "limit": 25,
- "total_items": 3,
- "next_page": "",
- "previous_page": ""
- }
- }
- """
- *************************************
- Scenario: Can't create a ride without authentication
- When I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "2018-03-17 15:30:02",
- "bike" : 1,
- "location": {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- }
- """
- Then the response code should be 401
- Failed asserting that 404 is identical to 401.
- *************************************
- Scenario: Can create a ride
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "2018-03-20 15:30:15",
- "bike" : 1,
- "locations": [
- {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- ]
- }
- """
- Then the response code should be 201
- And I follow the link in the Location response header
- And the response should contain json:
- """
- {
- "id": 5,
- "started_at": "2018-03-20 15:30:15",
- "locations": [
- {
- "id": 5,
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- ],
- "_links": {
- "self": {
- "href": "http://oribiky-api.local/api/users/5/rides"
- },
- "bike": {
- "href": "http://oribiky-api.local/api/bikes/1"
- },
- "finish": {
- "href": "http://oribiky-api.local/api/users/5/rides/finish"
- },
- "update_location": {
- "href": "http://oribiky-api.local/api/users/5/rides/location"
- }
- }
- }
- """
- *******************************************
- Scenario: Can't create a ride with invalid data
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "XXXXXX",
- "bike" : 1,
- "locations": [
- {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- ]
- }
- """
- Then the response code should be 400
- And the response should contain "Validation Failed"
- *********************************************
- Scenario: Can't create a ride with invalid data
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "2018-01-20 15:03:00",
- "bike" : "XX",
- "locations": [
- {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- ]
- }
- """
- Then the response code should be 400
- And the response should contain "Validation Failed"
- ***********************************************
- Scenario: Can't create a ride with invalid data
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "2018-01-20 15:03:00",
- "bike" : 1,
- "locations": []
- }
- """
- Then the response code should be 400
- And the response should contain "Validation Failed"
- ********************************************************
- Scenario: Can't create a ride with invalid data
- When I am successfully logged in with username: "john@test.org", and password: "johnpass"
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/rides" with body:
- """
- {
- "startedAt" : "2018-01-20 15:03:00",
- "bike" : 1,
- "locations": "XXXX"
- }
- """
- Then the response code should be 400
- And the response should contain "Validation Failed"
- *******************************************************
- Scenario: Can't add a ride location without authentication # features\user_rides.feature:217
- When I send a "POST" request to "/api/users/1/rides/location" with body: # App\Features\Context\RestApiContext::iSendARequestWithBody()
- """
- {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- """
- Then the response code should be 401 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
- Failed asserting that 404 is identical to 401.
- Scenario: Can't add a new location for another user's ride # features\user_rides.feature:227
- When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
- Failed asserting that 404 is identical to 200.
- And I send a "POST" request to "/api/users/1/rides/location" with body: # App\Features\Context\RestApiContext::iSendARequestWithBody()
- """
- {
- "latitude": 48.9197437,
- "longitude": 2.3607071
- }
- """
- Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
- Scenario: Can't view ride details without authentication # features\user_rides.feature:239
- When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
- Failed asserting that 404 is identical to 200.
- And I send a "GET" request to "/api/users/1/rides" # App\Features\Context\RestApiContext::iSendARequest()
- Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
- Scenario: Can't view details on another user's ride # features\user_rides.feature:244
- When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
- Failed asserting that 404 is identical to 200.
- And I send a "GET" request to "/api/users/1/rides" # App\Features\Context\RestApiContext::iSendARequest()
- Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement