diff --git a/requirements.txt b/requirements.txt index 3c3d0e7..0d3c63b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ pluggy==0.12.0 py==1.8.0 pyparsing==2.4.0 pytest==5.0.0 +pytest-env==0.6.2 requests==2.22.0 six==1.12.0 urllib3==1.25.3 diff --git a/tests/app_test.py b/tests/app_test.py index 6112957..10b30a2 100644 --- a/tests/app_test.py +++ b/tests/app_test.py @@ -1,7 +1,6 @@ import pytest from web import app - @pytest.fixture def client(): app.app.config['TESTING'] = True @@ -12,4 +11,15 @@ def client(): def test_root_page(client): rv = client.get('/') - assert b'Hello World!' in rv.data + assert rv.status_code == 200 + assert b'Please enter your first name and initial' in rv.data + +def test_generate_first(client): + rv2 = client.post('/generate', data=dict(name='tester'), follow_redirects=True) + assert rv2.status_code == 200 + assert b'Please mark all of your bottlecaps with the following identifier: A' in rv2.data + +def test_generate_second(client): + rv = client.post('/generate', data=dict(name='tester'), follow_redirects=True) + assert rv.status_code == 200 + assert b'Please mark all of your bottlecaps with the following identifier: B' in rv.data \ No newline at end of file diff --git a/web/app.py b/web/app.py index 3686b35..576609a 100644 --- a/web/app.py +++ b/web/app.py @@ -1,10 +1,12 @@ from flask import Flask, render_template, request +from flask_bootstrap import Bootstrap import sqlite3 import os import string app = Flask(__name__) +Bootstrap(app) def get_db_connection(): diff --git a/web/templates/generate.html b/web/templates/generate.html index 2a4aa95..f52e610 100644 --- a/web/templates/generate.html +++ b/web/templates/generate.html @@ -1,11 +1,19 @@ - - - - - Wigan Homebrew Club Competition Entry - - -

Wigan Homebrew Club Competition Entry

-

You have been entered into the competition to brew a {{ brew_name }}, for {{ brew_month }}. Please mark all of your bottlecaps with the following identifier: {{ identifier }}

- - \ No newline at end of file +{% extends "bootstrap/base.html" %} +{% block title %}Wigan Homebrew Club Competition Entry{% endblock %} + +{% block content %} +
+
+

Wigan Homebrew Club Competition Entry

+
+
+
+
+

You have been entered into the competition to brew a {{ brew_name }}, which will be judged at the meeting in {{ brew_month }}.

+
+

Please mark all of your bottlecaps with the following identifier: {{ identifier }}

+
+
+ +
+{% endblock %} \ No newline at end of file diff --git a/web/templates/index.html b/web/templates/index.html index 94a64d8..01de2b6 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -1,17 +1,27 @@ - - - - - Wigan Homebrew Club Competition Entry - - -

Wigan Homebrew Club Competition Entry

-

The next competition brew will be a {{ brew_name }}. It will be judged at the meeting in {{ brew_month }}

-

If you would like to enter the competition, please enter your name below to generate a letter/number that will be used to identify your entry

-
- -
- -
- - \ No newline at end of file +{% extends "bootstrap/base.html" %} +{% block title %}Wigan Homebrew Club Competition Entry{% endblock %} + +{% block content %} +
+
+

Wigan Homebrew Club Competition Entry

+
+
+
+
+

The next competition brew will be a {{ brew_name }}. It will be judged at the meeting in {{ brew_month }}

+
+

If you would like to enter the competition, please enter your name below to generate a letter/number that will be used to identify your entry

+
+
+
+ + +
+ +
+
+
+ +
+{% endblock %} \ No newline at end of file