KAMI-Airlines
Setup and installation
To set up and run the project, follow these steps:
- Create a virtual environment (recommended) and activate it (use git bash recommended):
python -m venv venv source venv/bin/activate
- Install the required Python packages from the requirements.txt file:
pip install -r requirements.txt
- Run the migrate command to automate creation of tables:
python manage.py migrate
- Run the server using this following commands:
The server should now be accessible at http://localhost:8000/.
python manage.py runserver
List of available APIs
Swagger Docs
- GET http://localhost:8000/
- GET hhttp://localhost:8000/api/docs/
Users API
- GET http://localhost:8000/users/login
- GET hhttp://localhost:8000/users/register
How to use the access token to access airplanes api endpoint.
- create a user account and log in using the valid credentials
- copy the access_token from the response data
- click authorize at the top portion. And the value should be - "Bearer Your_Token"
Airplanes API
- GET http://localhost:8000/api/airplanes
- GET http://localhost:8000/api/airplanes/{id}
- POST http://localhost:8000/api/airplanes/add
- POST http://localhost:8000/api/airplanes/bulk_add
- PUT http://localhost:8000/api/airplanes/update/{id}
- DELETE http://localhost:8000/api/airplanes/delete/{id}
- DELETE http://localhost:8000/api/airplanes/delete/
Tests
To run unit tests, follow these steps
- Make sure the server is running
- Open a new terminal and create a virtual environment (recommended) and activate it (use git bash recommended):
python -m venv venv source venv/bin/activate
- Run unit tests using this following commands:
python manage.py test api/
- There are a total of 38 tests.
Code Coverage Results
To run code coverage, follow these steps