NYU-Wishlists / wishlists

0 stars 1 forks source link

wishlists

Build Status codecov

Wishlists RESTful service allows customers to create a collection of products that they wish they had the money to purchase.

Team: Hu Jianyuan, Omer Katz, Sakada Lim, Minh Lai, Doyeon Kong

Prerequisite Installation using Vagrant

The easiest way to use this lab is with Vagrant and VirtualBox. if you don't have this software the first step is down download and install it.

Download VirtualBox

Download Vagrant

Clone the project to your development folder and create your Vagrant vm

    git clone https://github.com/NYU-Wishlists/wishlists.git
    cd wishlists
    vagrant up

Once the VM is up you can use it with:

    vagrant ssh
    cd /vagrant
    python run.py

Alternatively you can also start by using honcho

    vagrant ssh
    cd /vagrant
    honcho start

Honcho makes use of the Procfile to start the service using Gunicorn similar to how one would start the server in production.

You should now be able to see the service running in your browser by going to http://localhost:5000. You will see a message about the service which looks something like this:

{
    name: "Wishlist Demo REST API Service",
    url: "http://localhost:5000/wishlists",
    version: "1.0"
}

When you are done, you can use Ctrl+C within the VM to stop the server.

Testing

Run the test using behave

    cd /vagrant
    python run.py &
    behave

Note that the & runs the server in the background. To stop the server, you must bring it to the foreground and then press Ctrl+C

Stop the server with

    fg
    <ctrl+c>

This repo also has a unit test that you can run with

    cd /vagrant
    nosetests

You should see all of the tests passing with a code coverage report at the end. This is controlled by the setup.cfg file in the repo.

Services

With a specific wishlist ID, you can perform the following action:

Other actions that can be performed:

Shutdown

When you are done, you can use the exit command to get out of the virtual machine just as if it were a remote server and shut down the vm with the following:

    exit
    vagrant halt

If the VM is no longer needed you can remove it with from your computer to free up disk space with:

    vagrant destroy