Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.74 KB | None | 0 0
  1. Scenario: Can't view Rides list without authentication
  2. When I send a "GET" request to "/api/users/rides"
  3. Then the response code should be 401
  4. Failed asserting that 404 is identical to 401.
  5.  
  6. *******************************
  7. Scenario: Can view Rides list
  8. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  9. Failed asserting that 404 is identical to 200.
  10. And I send a "GET" request to "/api/users/rides"
  11. Then the response code should be 200
  12. And the response should contain json:
  13. """
  14. {
  15. "meta": {
  16. "limit": 25,
  17. "total_items": 3,
  18. "next_page": "",
  19. "previous_page": ""
  20. }
  21. }
  22. """
  23. *************************************
  24.  
  25. Scenario: Can't create a ride without authentication
  26. When I send a "POST" request to "/api/users/rides" with body:
  27. """
  28. {
  29. "startedAt" : "2018-03-17 15:30:02",
  30. "bike" : 1,
  31. "location": {
  32. "latitude": 48.9197437,
  33. "longitude": 2.3607071
  34. }
  35. }
  36. """
  37. Then the response code should be 401
  38. Failed asserting that 404 is identical to 401.
  39.  
  40.  
  41. *************************************
  42.  
  43. Scenario: Can create a ride
  44. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  45. Failed asserting that 404 is identical to 200.
  46. And I send a "POST" request to "/api/users/rides" with body:
  47. """
  48. {
  49. "startedAt" : "2018-03-20 15:30:15",
  50. "bike" : 1,
  51. "locations": [
  52. {
  53. "latitude": 48.9197437,
  54. "longitude": 2.3607071
  55. }
  56. ]
  57. }
  58. """
  59. Then the response code should be 201
  60. And I follow the link in the Location response header
  61. And the response should contain json:
  62. """
  63. {
  64. "id": 5,
  65. "started_at": "2018-03-20 15:30:15",
  66. "locations": [
  67. {
  68. "id": 5,
  69. "latitude": 48.9197437,
  70. "longitude": 2.3607071
  71. }
  72. ],
  73. "_links": {
  74. "self": {
  75. "href": "http://oribiky-api.local/api/users/5/rides"
  76. },
  77. "bike": {
  78. "href": "http://oribiky-api.local/api/bikes/1"
  79. },
  80. "finish": {
  81. "href": "http://oribiky-api.local/api/users/5/rides/finish"
  82. },
  83. "update_location": {
  84. "href": "http://oribiky-api.local/api/users/5/rides/location"
  85. }
  86. }
  87. }
  88. """
  89.  
  90. *******************************************
  91.  
  92.  
  93. Scenario: Can't create a ride with invalid data
  94. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  95. Failed asserting that 404 is identical to 200.
  96. And I send a "POST" request to "/api/users/rides" with body:
  97. """
  98. {
  99. "startedAt" : "XXXXXX",
  100. "bike" : 1,
  101. "locations": [
  102. {
  103. "latitude": 48.9197437,
  104. "longitude": 2.3607071
  105. }
  106. ]
  107. }
  108. """
  109. Then the response code should be 400
  110. And the response should contain "Validation Failed"
  111.  
  112. *********************************************
  113.  
  114. Scenario: Can't create a ride with invalid data
  115. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  116. Failed asserting that 404 is identical to 200.
  117. And I send a "POST" request to "/api/users/rides" with body:
  118. """
  119. {
  120. "startedAt" : "2018-01-20 15:03:00",
  121. "bike" : "XX",
  122. "locations": [
  123. {
  124. "latitude": 48.9197437,
  125. "longitude": 2.3607071
  126. }
  127. ]
  128. }
  129. """
  130. Then the response code should be 400
  131. And the response should contain "Validation Failed"
  132.  
  133. ***********************************************
  134.  
  135. Scenario: Can't create a ride with invalid data
  136. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  137. Failed asserting that 404 is identical to 200.
  138. And I send a "POST" request to "/api/users/rides" with body:
  139. """
  140. {
  141. "startedAt" : "2018-01-20 15:03:00",
  142. "bike" : 1,
  143. "locations": []
  144. }
  145. """
  146. Then the response code should be 400
  147. And the response should contain "Validation Failed"
  148.  
  149. ********************************************************
  150.  
  151. Scenario: Can't create a ride with invalid data
  152. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  153. Failed asserting that 404 is identical to 200.
  154. And I send a "POST" request to "/api/users/rides" with body:
  155. """
  156. {
  157. "startedAt" : "2018-01-20 15:03:00",
  158. "bike" : 1,
  159. "locations": "XXXX"
  160. }
  161. """
  162. Then the response code should be 400
  163. And the response should contain "Validation Failed"
  164.  
  165. *******************************************************
  166.  
  167. Scenario: Can't add a ride location without authentication # features\user_rides.feature:217
  168. When I send a "POST" request to "/api/users/1/rides/location" with body: # App\Features\Context\RestApiContext::iSendARequestWithBody()
  169. """
  170. {
  171. "latitude": 48.9197437,
  172. "longitude": 2.3607071
  173. }
  174. """
  175. Then the response code should be 401 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
  176. Failed asserting that 404 is identical to 401.
  177.  
  178. Scenario: Can't add a new location for another user's ride # features\user_rides.feature:227
  179. When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
  180. Failed asserting that 404 is identical to 200.
  181. And I send a "POST" request to "/api/users/1/rides/location" with body: # App\Features\Context\RestApiContext::iSendARequestWithBody()
  182. """
  183. {
  184. "latitude": 48.9197437,
  185. "longitude": 2.3607071
  186. }
  187. """
  188. Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
  189.  
  190. Scenario: Can't view ride details without authentication # features\user_rides.feature:239
  191. When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
  192. Failed asserting that 404 is identical to 200.
  193. And I send a "GET" request to "/api/users/1/rides" # App\Features\Context\RestApiContext::iSendARequest()
  194. Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
  195.  
  196. Scenario: Can't view details on another user's ride # features\user_rides.feature:244
  197. When I am successfully logged in with username: "john@test.org", and password: "johnpass" # App\Features\Context\RestApiContext::iAmSuccessfullyLoggedInWithUsernameAndPassword()
  198. Failed asserting that 404 is identical to 200.
  199. And I send a "GET" request to "/api/users/1/rides" # App\Features\Context\RestApiContext::iSendARequest()
  200. Then the response code should be 403 # App\Features\Context\RestApiContext::theResponseCodeShouldBe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement