Coder Social home page Coder Social logo

hotdogger's Introduction

New Hire Example Test Project

This project is designed to test potential hires for structure and Django understanding. It has several flaws the candidate should identify and fix.

To begin follow steps in the getting started section. After initial setup, create a new git branch for your work. Then tackle each section marked as a ticket in order. To consider a ticket complete you will need replicate, resolve the complaint, and write meaningful unit tests for your solution. Comment & add documentation where necessary

Once complete, submit a pull request to merge your improvements & fixes to the master branch.

Getting Started

  1. Install Requirements
    a. Create a python3 virtual environment
    b. activate it
    c. Install requirements pip install -r requirements.txt
  2. Create a postgres database called hotdogger
    a. psql
    b. CREATE DATABASE hotdogger;
  3. Run migrations python manage.py migrate
  4. Install fixtures python manage.py loaddata vendors/fixtures/data.json
  5. Create a super user python manage.py createsuperuser
  6. Start the instance python manage.py runserver
  7. Visit http://localhost:8000/accounts/signup/

Note: users/employees need to be added to an employer/vendor. You can create a view to do this or do so in the django admin at /admin/.

API Documentation

Hotdogger utilizes Django REST Swagger for its API docs. In debug mode, this documentation is available at /api-docs/.

Testing

Hotdogger uses the standard testing library for both DRF and Django. Coverage reports can be generated by running coverage run manage.py test. To view the coverage report coverage report -m.

Ticket 1

QA witnessed a regression in test coverage. Please confirm regress and update and/or create unit tests where necessary. For this ticket do not worry about failing tests. Just add tests where necessary to achieve 100% test coverage. Broken test will be resolved later. This is just a warmup ;)

Ticket 2

The CEO of Hotdogger Inc was browsing the site while not logged in. He was able to view the vendor list without being authenticated. Needless to say, this is a major problem. Investigate all endpoints and implement security measures. Then prove with unit tests that this is no longer a problem.
Bonus points if you can ensure most hotdogger urls are protected.
Hint:
from django.urls import get_resolver
urls = set(v[1] for k,v in get_resolver(None).reverse_dict.items())
Some of the urls in this url set will need to be available for non-authenticated users. So those urls should be whitelisted.

Ticket 3

It appears vendors are able to see their competitor's product offering. Often, this is a major competitive advantage for a vendor. This represents a breach of trust. Ensure vendors can only see their own offerings. This applies to BOTH /vendors/items/ and the API.

Ticket 4

Hot dog options not yet available are showing up in the vendor items list view. Make sure that only available products are displayed.

Ticket 5

Our clients are starting to notice a lag in response times in the vendor item listing. Investigate. If possible improve page queries WITHOUT the aid of caching.

Ticket 6

Some clients have 100s of product offerings. Limit the number of offerings to 20 items per page. Utilize features of django's ListView feature to achieve this. There's a prebuilt template partial you will need to include for pagination navigation in the `templates' dir.

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.