Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast api conversion #565

Merged
merged 64 commits into from
Apr 5, 2022
Merged

Fast api conversion #565

merged 64 commits into from
Apr 5, 2022

Conversation

lhain08
Copy link
Contributor

@lhain08 lhain08 commented Apr 2, 2022

Issue

Converted API from Flask to FastAPI and wrote test cases for all endpoints

closes #522

Database Changes/Migrations

No database changes

Test Modifications

Added unit tests for all api endpoints, new CI workflow step for API Tests.
Tests located in src/api/tests

Test Procedure

Checkout this branch and run

docker-compose -f src/api/tests/docker-compose.yml up --build --abort-on-container-exit

This will execute all tests.
You can also run the development docker containers and go to localhost:5000/docs or localhost:5000/redoc to see all documentation for the new API

Photos

Screen Shot 2022-04-02 at 1 20 22 AM

lhain08 and others added 30 commits February 8, 2022 00:40
* update requirements

* added session test cases
* Finished first draft of tests for class and department endpoints

* Fixed issues with the first draft tests

* made recommended changes and added note to class endpoint check about admin non-public semesters
* preliminary fastapi converting

* converted to FastAPI

* implemented fastapi-cache

* removed backup

* removed no longer needed commented code

* removed no longer needed commented code

* converted pytests to use FastAPI TestClient, added automation script

* moved markers from conftest to .ini

* added documentation for how to update endpoints and added CI for running tests

* commented out tests that need updating

* added missing requirement

* set env variables

* automated database cleaning

* updated old mock_cache to work for fastapi-cache so old pytests work

* uncommented CI step for old pytests
* semester and subsemester tests

* updated comments
* Create test_user_course.py

* Update test_user_course.py

* Update failure case and minor change on success post

* Minor changes

* Debugging json on line 26

* Passed post success and failure for user/course

* Clear comments for pr requirements

* Added not authorized test and followed pr requirements
* Finished Semester Info Endpoint

* Finished Default Semester Endpoint
* added session test cases

* test

* test user-get success

* test user get false

* test user put

* Fixed test client sessions

* delete cookie, using session

* delete unrelated comments

* add post_user

* add test_get_user_after_session_closed

* test put user after session closed

* remove unrelated code

* remove print

Co-authored-by: Liam Haining <ljhaining@gmail.com>
hhdtc and others added 13 commits April 1, 2022 16:19
* some brief changes

* test

* add to api_models

* change some fastapi tests

* try chaning to fastapi

* current progress

* request.session

* not in request.session

* request: Request

* status_code

* test bug

* change test client back

* remove unrelated comment
* app.py

* fix?

* fixed tests

Co-authored-by: Sachin Khanijow <sachinkhanijow@chikadee-377.dynamic.rpi.edu>
* modify the api user course delete function

* fastapi-conversion-course-get-and-delete

* arg for remove_selection
@lhain08 lhain08 requested a review from RichtXO April 2, 2022 05:25
Copy link

@jaw12346 jaw12346 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the comments that I made regarding dead code. If this remaining dead code is intentionally still in the files, you have my approval.

@lhain08 lhain08 requested a review from jaw12346 April 5, 2022 21:20
@lhain08 lhain08 merged commit 51138e1 into master Apr 5, 2022
@lhain08 lhain08 deleted the FastAPIConversion branch April 5, 2022 21:23
@lhain08 lhain08 self-assigned this Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request — Update API From Flask to FastAPI