iReporter is a flask RESTful API that enables users to:
- Raise a red-flag
- view a list of red-flags
- view a particular red-flag
- Edit a red-flag's property
- Delete a red-flag record
-
Clone the repository by doing:
git clone https://github.com/dmukuna/iReporter.git
-
Create a virtual environment:
virtualenv env
-
Activate the virtual environment:
source venv/bin/activate
on Linux/Mac orsource venv/Scripts/activate
on windows. -
Install the requirements :
pip install -r requirements.txt
- Run this command on the terminal:
pytest --cov-report term-missing --cov=app
###Break down into end to end tests
The application has been hosted on heroku. Below, is the link to the application
- Python 3.6.7
- virtual environment
-
Create a .env file to store your environment variables:
touch .env
-
In the
.env
file add this lines:export SECRET=<your-secret-key-here
andexport FLASK_APP="run.py"
-
On terminal do:
source .env
-
Run the application:
flask run
-
The api endpoints can be consumed using postman.
Tests the below payload with indicted endpoints
{
'created_by': '1,
'created_on': '1/2/2018',
'comment': 'description is ...',
'incident_type': 'red-flag',
'image': 'image',
'video': 'video',
'location': '1.34532, 36.1552',
'status': 'resolved',
}
Endpoint | FUNCTIONALITY |
---|---|
POST /api/v1/red-flags | This will create a red-flag |
GET /api/v1/red-flags | This will get all red-flags |
GET /api/v1/red-flags/flag_Id | retrieve a single red-flag by id |
PUT /api/v1/red-flags/flag_Id | Update a red-flag record |
DELETE /api/v1/red-flags/flag_Id | Delete a red-flag record |
PATCH /api/v1/red-flags/flag_Id/attr | This will modify a red-flag's property |