cyntaria/UniPal-Backend

[GET] All Terms

arafaysaleem opened this issue · 0 comments

Summary

As an admin, I should be able to get all possible terms, so that I can choose one while creating classes.

Acceptance Criteria

GIVEN a student is creating all possible terms in the app
WHEN the app hits the /terms endpoint with a valid GET request
THEN the app should receive a status 200
AND in the response, the following information should be returned:

  • headers
  • list of terms

Sample Request/Sample Response

headers: {
    error: 0,
    message: "..."
}
body: [
    {
        term_id: 1,
        term: "Fall 2020"
    },
    {
        term_id: 2,
        term: "Spring 2021"
    },
    ....
]

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

None

Testing Notes

Scenario 1: GET request is successful

GIVEN a student is creating all possible terms in the app
WHEN the app hits the /terms endpoint with a valid GET request
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:

  • term_id
  • term
Scenario 2: GET request is unsuccessful due to no terms

GIVEN a student is creating all possible terms in the app
WHEN the app hits the /terms endpoint with a valid GET request
THEN the app should receive a status 404
AND the response headers' code parameter should contain "NotFoundException"

Scenario 3: GET request is forbidden

GIVEN an student is requesting all possible terms in the app
WHEN the app hits the /terms endpoint with a valid GET request
THEN the app should receive a status 403
AND the response headers' code parameter should contain "ForbiddenException"

Scenario 4: GET request is unauthorized

GIVEN a student is creating all possible terms in the app
WHEN the app hits the /terms 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' code parameter should contain "TokenMissingException"