[PATCH] A Timetable
arafaysaleem opened this issue · 0 comments
arafaysaleem commented
Summary
As a student
, I should be able to update details of a timetable, so that I can make the necessary changes.
Acceptance Criteria
GIVEN a student
is editing a timetable in the app
WHEN the app hits the /timetables/:id
endpoint with a valid PATCH request, containing:-
The path parameter:
:id
, the unique id of the entity of which the details are edited.
And any of the following body parameters:
is_active
tinyint(1)
THEN the app should receive a status 200
AND in the response, the following information should be returned:
- header message indicating update operation success
- rows matched
- rows changed
Sample Request/Sample Response
headers: {
error: 0,
message: "The specified item was updated successfully"
}
body: {
rows_matched: 1,
rows_changed: 1,
info: "..."
}
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
{Some complementary notes if necessary}
Testing Notes
Scenario 1: PATCH request is successful (Owner)
- Update a timetable with a PATCH request to
/timetables/:id
endpoint withstudent_erp
== erp instudent
account token and ensure a200
status code is returned. - A subsequent GET request to
/timetables/:id
endpoint should return a status code200
- And the post details with the updated information i.e. matching the initially sent body.
- Resubmit a PATCH request to
/timetables/:id
endpoint to reverse the change and ensure status code200
is returned.
Scenario 2: PATCH request is unsuccessful due to unknown timetable_id
- Update a timetable with a PATCH request to
/timetables/:id
endpoint containing a non-existenttimetable_id
. - Ensure a
404
status code is returned. - And the response headers'
code
parameter should contain "NotFoundException".
Scenario 3: PATCH request is incorrect
- Send a PATCH request to
/timetables/:id
endpoint with an incorrect key name in the body - Ensure a
422
status code is returned - And the response headers'
code
parameter should contain "InvalidPropertiesException". - And the response headers'
data
parameter should contain the name of the invalid parameter.
Scenario 4: PATCH request is forbidden (Unowned Student ERP)
- Send a PATCH request to
/timetables/:id
endpoint withstudent_erp
!= erp instudent
account token. - Ensure the response returns a
403
forbidden status code. - And the response headers'
code
parameter should contain "ForbiddenException"
Scenario 5: PATCH request is unauthorized
- Send a PATCH request to
/timetables/:id
endpoint without an authorization token - Ensure a
401
unauthorized status code is returned. - And the response headers'
code
parameter should contain "TokenMissingException"