[GET] All Reactions Of A Post #144
Labels
Status: Completed
Type: Feature
user story
A brief explanation of a functionality or an interaction with the system, from a user's perspective
Summary
As a
student
, I should be able to get reactions of a post, so that I can see who feels what.Acceptance Criteria
Scenario 1: Get All Reactions Of A Post
GIVEN an
student
is requesting reactions of a post in the appWHEN the app hits the
/posts/:id/reactions
endpoint with a valid GET request, containing the path parameter::id
, the unique id of the entity for which the reactions are needed.THEN the app should receive a status
200
AND in the response, the following information should be returned:
Sample Request/Sample Response
For e.g. we are requesting all reactions of a post with
post_id=1
Resources
Dev Notes
This endpoint is accessible by and serves the admin in the same way.
Testing Notes
Scenario 1: GET request is successful
GIVEN a
student
is requesting reactions of a post in the appWHEN the app hits the
/posts/:id/reactions
endpoint with a valid GET request, containing the path parameter::id
THEN the app should receive a status
200
AND the body should be an array
AND the first item of the array should be an object containing the following fields:
AND the
post_id
of each item should be equal to the path parameter:id
Scenario 2: GET request is unsuccessful due to unknown post_id
GIVEN a
student
is requesting reactions of a post in the appWHEN the app hits the
/posts/:id/reactions
endpoint with a valid GET request, containing the path parameter::id
, a non-existent idTHEN the app should receive a status
404
AND the response headers'
code
parameter should contain "NotFoundException"AND the response headers'
message
parameter should contain "Post not found"Scenario 3: GET request is unsuccessful due to zero reactions
GIVEN a
student
is requesting reactions of a post in the appAND no reactions of that post exist yet
WHEN the app hits the
/posts/:id/reactions
endpoint with a valid GET request, containing the path parameter::id
THEN the app should receive a status
404
AND the response headers'
code
parameter should contain "NotFoundException"AND the response headers'
message
parameter should contain "Post reactions not found"Scenario 4: GET request is unauthorized
GIVEN a
student
is requesting reactions of a post in the appWHEN the app hits the
/posts/:id/reactions
endpoint with a valid GET requestAND the request contains no authorization token
THEN the app should receive a status
401
AND the response headers'
code
parameter should contain "TokenMissingException"The text was updated successfully, but these errors were encountered: