KAMI-Airlines

Setup and installation

To set up and run the project, follow these steps:

  1. Create a virtual environment (recommended) and activate it (use git bash recommended):
    python -m venv venv
    source venv/bin/activate
  2. Install the required Python packages from the requirements.txt file:
    pip install -r requirements.txt
  3. Run the migrate command to automate creation of tables:
    python manage.py migrate
  4. Run the server using this following commands:
    python manage.py runserver
    The server should now be accessible at http://localhost:8000/.

List of available APIs

Swagger Docs

Swagger Documentation

Users API

Swagger Documentation Users API

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" Swagger Documentation Token Auth Demo

Airplanes API

Swagger Documentation Airplanes API

Tests

To run unit tests, follow these steps

  1. Make sure the server is running
  2. 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
  3. Run unit tests using this following commands:
    python manage.py test api/
  • There are a total of 38 tests.

Test Results

Code Coverage Results

To run code coverage, follow these steps

  1. Run django tests witth the 'coverage' run command:

    coverage run manage.py test
  2. You can view a coverage reportt in the terminal by running:

    coverage report

    Code Coverage

  3. To generate html report, use the following command:

    coverage html
    • Then go to htmlcov folder and run index.html in the browser

    Code Coverage