[GET] A Single Teacher
arafaysaleem opened this issue · 0 comments
Summary
As an admin
, I should be able to get details of a teacher, so that I can understand what information it represents.
Acceptance Criteria
GIVEN an admin
is requesting details of a teacher in the app
WHEN the app hits the /teachers/:id
endpoint with a valid GET request, containing the path parameter:
:id
, the unique id of the entity for which the details are needed.
THEN the app should receive a status 200
AND in the response, the following information should be returned:
- headers
- teacher details
Sample Request/Sample Response
headers: {
error: 0,
message: "..."
}
body: {
teacher_id: 1,
full_name: "Waseem Arain",
average_rating: 4.0,
total_reviews: 40
}
Resources
- Development URL: {Here goes a URL to the feature on development API}
- Production URL: {Here goes a URL to the feature on production API}
Dev Notes
This endpoint is accessible by and serves the admin in the same way.
Testing Notes
Scenario 1: GET request is successful
GIVEN an admin
is requesting details of a teacher in the app
WHEN the app hits the /teachers/:id
endpoint with a valid GET request, containing the path parameter:
:id
THEN the app should receive a status 200
AND the {id}
in the body should be same as the :id
in the path parameter
Scenario 2: GET request is unsuccessful
GIVEN an admin
is requesting details of a teacher in the app
WHEN the app hits the /teachers/:id
endpoint with a valid GET request, containing the path parameter:
:id
, a non-existent id
THEN the app should receive a status 404
AND the response headers' id
parameter should contain "NotFoundException"
Scenario 3: GET request is forbidden
GIVEN a student
is requesting details of a teacher in the app
WHEN the app hits the /teachers/:id
endpoint with a valid GET request
THEN the app should receive a status 403
AND the response headers' id
parameter should contain "TokenMissingException"
Scenario 4: GET request is unauthorized
GIVEN an admin
is requesting details of a teacher in the app
WHEN the app hits the /teachers/:id
endpoint with a valid GET request
AND the request contains no authorization token
THEN the app should receive a status 401
AND the response headers' id
parameter should contain "TokenMissingException"