Skip to content

Svenskapojkarna/Florida-Man-Generator

 
 

Repository files navigation

PWP SPRING 2020

Florida Man Generator

Group information

Remember to include all required documentation and HOWTOs, including how to create and populate the database, how to run and test the API, the url to the entrypoint and instructions on how to setup and run the client

Overview of the API

Structure

(root)

LICENSE = License of the project
README.md. = THIS readmefile.
api_test.py = Test file for api-method testing.
apiary.apib. = Blueprint from Apiary
app.py = Main function(?).
db_test.py = Test file for database testing.
meetings.md = File containing meeting notes.
requirements.txt = Requirements file for installation.

db

db_test.py = Unit tests for the database.
db.py = Database models.
populate.py = Populate the database with initial values.
README.md = Instructions on how to use the database.
test.db = Populated database with initial values.

src

builders

addedarticlebuilder.py = Builder for added article resource.
articlebuilder.py = Builder for article resource.
masonbuilder.py = Builder to create resources. Used in other builders as dependency.
userbuilder.py = Builder for user resource.

Resources

addedarticleresource.py = Resource for added article collection and item.
articleresource.py = Resource for article collection and item.
entrypoint.py = Application entrypoint.
userresource.py = Resource for user collection and item.

Client/src

components

AddedArticle.jsx = One added article component.
api.js = Global configuration of API
Article.jsx = One initial article component
serviceWorker.js = Needed for React application

pages

App.jsx = Landing page.
CheckInitialMemes.jsx = Page to search for the initial memes.
CheckUserMemes.jsx = Page to search, edit and delete user created articles. User can also create a new article for himself.
CreateNewArticle.jsx = Page to create a new user and a new article.

Usage

Installing dependencies

  1. (Install virtualenv) (virtualenv is not in requirements) (in case with problems on Windows, try first installing with)
python -m pip install virtualenv --user
  1. Activate python virtual environment in command line
virtualenv pwp
  1. Activate virtual environment
pwp\Scripts\activate.bat
  1. install dependencies
pip install -r requirements.txt
  1. start the API
flask run

Test the API

Run apitest and db_test with pytest in the root folder. Configure it to check both app.py and src folder. To do this:

pytest --cov=app --cov=src

Tests

db_test

pytest db_test.py

This command will test CRUD operations in each model. In addition, uniqueness of the date will be tested. The tests will also check that the headline and the modification date are not null.

api_test

pytest api_test.py

This command will test the API methods for each resource. (At the moment it tests only user)

About

This repo is for programmable web project course work.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 39.9%
  • API Blueprint 38.0%
  • JavaScript 21.7%
  • HTML 0.4%