Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 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.  
  4. Then the response code should be 401
  5.  
  6. Fatal error: Call to a member function getStatusCode() on null (Behat\Test work\Call\Exception\FatalThrowableError)
  7.  
  8. ***************
  9.  
  10. Scenario: Can view Rides list
  11.  
  12. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  13.  
  14. Fatal error: Call to a member function getStatusCode() on null (Behat\Testwork\Call\Excep tion\FatalThrowableError)
  15. And I send a "GET" request to "/api/users/rides"
  16.  
  17. Then the response code should be 200
  18.  
  19. And the response should contain json:
  20.  
  21. """
  22. {
  23. "meta": {
  24. "limit": 25,
  25. "total_items": 3,
  26. "next_page": "",
  27. "previous_page": ""
  28. }
  29. }
  30. """
  31.  
  32. ************************************************
  33.  
  34.  
  35. Scenario: Can't create a ride without authentication
  36.  
  37. When I send a "POST" request to "/api/users/rides" with body:
  38.  
  39. """
  40. {
  41. "startedAt" : "2018-03-17 15:30:02",
  42. "bike" : 1,
  43. "location": {
  44. "latitude": 48.9197437,
  45. "longitude": 2.3607071
  46. }
  47. }
  48. """
  49. Then the response code should be 401
  50.  
  51. Fatal error: Call to a member function getStatusCode() on null (Behat\Testwork\Call\Excep tion\FatalThrowableError)
  52.  
  53. ***********************************************************
  54.  
  55. Scenario: Can create a ride
  56.  
  57. When I am successfully logged in with username: "john@test.org", and password: "johnpass"
  58.  
  59. Fatal error: Call to a member function getStatusCode() on null (Behat\Testwork\Call\Exception\FatalThrowableError)
  60. And I send a "POST" request to "/api/users/rides" with body:
  61.  
  62. """
  63. {
  64. "startedAt" : "2018-03-20 15:30:15",
  65. "bike" : 1,
  66. "locations": [
  67. {
  68. "latitude": 48.9197437,
  69. "longitude": 2.3607071
  70. }
  71. ]
  72. }
  73. """
  74. Then the response code should be 201
  75.  
  76. And I follow the link in the Location response header
  77.  
  78. And the response should contain json:
  79.  
  80. """
  81. {
  82. "id": 5,
  83. "started_at": "2018-03-20 15:30:15",
  84. "locations": [
  85. {
  86. "id": 5,
  87. "latitude": 48.9197437,
  88. "longitude": 2.3607071
  89. }
  90. ],
  91. "_links": {
  92. "self": {
  93. "href": "http://oribiky-api.local/api/users/5/rides"
  94. },
  95. "bike": {
  96. "href": "http://oribiky-api.local/api/bikes/1"
  97. },
  98. "finish": {
  99. "href": "http://oribiky-api.local/api/users/5/rides/finish"
  100. },
  101. "update_location": {
  102. "href": "http://oribiky-api.local/api/users/5/rides/location"
  103. }
  104. }
  105. }
  106. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement