Giter Site home page Giter Site logo

fetch_challenge's Introduction

Fetch_Challenge

Receipt Processor Challenge

The webservice is created using Python and Django.

INSTRUCTIONS TO RUN THE SERVICE

  1. Clone the repository to your local machine.

  2. At the root of the working directory (i.e. where the Dockerfile is present) run the following docker commands to have the service up and running:

    docker build --tag python-django .
    
    docker run --publish 8000:8000 python-django
    

Additional Information:

  1. The code for the endpoints can be found in the receipts application: "receipts/views.py"

  2. The test cases for the service can be found in the receipts application: "receipts/tests.py". Below are the different edge cases covered:

    • Test for processing receipts with a valid payload (Returns 200 status code and response contains an id).
    • Test for processing receipts with invalid payload (Returns 400 status code).
    • Test to get points when the receipt is found (Returns 200 status code and response contains the points).
    • Test for getting points when the receipt is not found (Return 404 status code).
    • Test for testing the function that calculates the points (Returns the correct points earned).
  3. Can use Postman or any other service to test the below urls. "http://127.0.0.1:8000/receipts/process" "http://127.0.0.1:8000/receipts/id/points"

  4. Below are the screenshots for the POST and GET requests made to the service using Postman.

    POST request GET request

  5. Steps to run the test cases on a local machine:

    • Create a python virtual environment: "python -m venv ./py-django" (Note: py-django is the name of the virtual environment)
    • Activate the environment by running: "py-django/Scripts/activate"
    • Install Django using : "pip install django"
    • Run the test cases from root of the repository by running: "python manage.py test". Output: Test Cases

fetch_challenge's People

Contributors

prathmesh4321 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.