PromotionsSquad / promotions

Apache License 2.0
0 stars 0 forks source link

Markdown for Badges

Build Status Build Status codecov

Promotions

The promotions resource allows marketing managers to create, read, update, delete, search, and list promotions. At a minimum a promoution should contain a name, a start date, an end date, and whether or not the promotion is active.

Prerequisite Software Installation

This lab uses Docker and Visual Studio Code with the Remote Containers extension to provide a consistent repeatable disposable development environment for all of the labs in this course.

You will need the following software installed:

Docker Desktop

Visual Studio Code

Remote Containers extension from the Visual Studio Marketplace

All of these can be installed manually by clicking on the links above or you can use a package manager like Homebrew on Mac of Chocolatey on Windows.

Alternately, you can use Vagrant and VirtualBox to create a consistent development environment in a virtual machine (VM).

You can read more about creating these environments in John Rofrano's article: Creating Reproducable Development Environments

Bring up the development environment

  1. Navigate to DevOps Folder
  2. Clone the Repo
$ git clone https://github.com/PromotionsSquad/promotions.git
  1. Change directory to promotions:
$ cd promotions
  1. Open Visual Studio Code using the code . command. VS Code will prompt you to reopen in a container and you should say yes. This will take a while as it builds the Docker image and creates a container from it to develop in.
$ code .

Note that there is a period . after the code command. This tells Visual Studio Code to open the editor and load the current folder of files.

  1. Open in Container - Make sure docker is running or you won't be able to open in container
  2. Pull up-to-date code from GitHub
$ git pull

Running Nosetests

As developers we always want to run the tests before we change any code. That way we know if we broke the code or if someone before us did. Always run the test cases first!

  1. Run the tests using nosetests
$ nosetests

Accessing WebUI and Running BDD Tests

  1. The project uses honcho which gets it's commands from the Procfile. To start the service simply use:
$ honcho start

You should be able to reach the service at: http://localhost:8080. The port that is used is controlled by an environment variable defined in the .flaskenv file which Flask uses to load it's configuration from the environment by default.

Once in the environment try various actions such as:

  1. Run behave tests
$ behave