Updated tests
This commit is contained in:
@@ -18,6 +18,7 @@ pluggy==0.12.0
|
|||||||
py==1.8.0
|
py==1.8.0
|
||||||
pyparsing==2.4.0
|
pyparsing==2.4.0
|
||||||
pytest==5.0.0
|
pytest==5.0.0
|
||||||
|
pytest-env==0.6.2
|
||||||
requests==2.22.0
|
requests==2.22.0
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
urllib3==1.25.3
|
urllib3==1.25.3
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from web import app
|
from web import app
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def client():
|
def client():
|
||||||
app.app.config['TESTING'] = True
|
app.app.config['TESTING'] = True
|
||||||
@@ -12,4 +11,15 @@ def client():
|
|||||||
def test_root_page(client):
|
def test_root_page(client):
|
||||||
|
|
||||||
rv = client.get('/')
|
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: <strong>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: <strong>B' in rv.data
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
from flask import Flask, render_template, request
|
from flask import Flask, render_template, request
|
||||||
|
from flask_bootstrap import Bootstrap
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
Bootstrap(app)
|
||||||
|
|
||||||
|
|
||||||
def get_db_connection():
|
def get_db_connection():
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
{% extends "bootstrap/base.html" %}
|
||||||
<html lang="en">
|
{% block title %}Wigan Homebrew Club Competition Entry{% endblock %}
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
{% block content %}
|
||||||
<title>Wigan Homebrew Club Competition Entry</title>
|
<div class="container">
|
||||||
</head>
|
<div class="jumbotron text-center">
|
||||||
<body>
|
<h2>Wigan Homebrew Club Competition Entry</h2>
|
||||||
<h1>Wigan Homebrew Club Competition Entry</h1>
|
</div>
|
||||||
<p>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: <strong>{{ identifier }}</strong></p>
|
<div class="row">
|
||||||
</body>
|
<div class="col-md-2"></div>
|
||||||
</html>
|
<div class="col-md-8">
|
||||||
|
<p><p>You have been entered into the competition to brew a <strong>{{ brew_name }}</strong>, which will be judged at the meeting in <strong>{{ brew_month }}</strong>.</p>
|
||||||
|
<br/>
|
||||||
|
<p class="bg-success lead text-center" style="padding: 10px 10px 10px 10px">Please mark all of your bottlecaps with the following identifier: <strong>{{ identifier }}</strong></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,17 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
{% extends "bootstrap/base.html" %}
|
||||||
<html lang="en">
|
{% block title %}Wigan Homebrew Club Competition Entry{% endblock %}
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
{% block content %}
|
||||||
<title>Wigan Homebrew Club Competition Entry</title>
|
<div class="container">
|
||||||
</head>
|
<div class="jumbotron text-center">
|
||||||
<body>
|
<h2>Wigan Homebrew Club Competition Entry</h2>
|
||||||
<h1>Wigan Homebrew Club Competition Entry</h1>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2"></div>
|
||||||
|
<div class="col-md-8">
|
||||||
<p>The next competition brew will be a <strong>{{ brew_name }}</strong>. It will be judged at the meeting in <strong>{{ brew_month }}</strong></p>
|
<p>The next competition brew will be a <strong>{{ brew_name }}</strong>. It will be judged at the meeting in <strong>{{ brew_month }}</strong></p>
|
||||||
|
<br/>
|
||||||
<p>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</p>
|
<p>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</p>
|
||||||
|
<hr>
|
||||||
<form action="{{ url_for('generate') }}" method="POST">
|
<form action="{{ url_for('generate') }}" method="POST">
|
||||||
<label for="name">Please enter your name and initial (eg: Sean C):</label>
|
<div class="form-group">
|
||||||
<input name="name" type="text" id="name"><br>
|
<label for="name">Please enter your first name and initial (or nickname)</label>
|
||||||
<button type="submit">Enter Competition</button>
|
<input name="name" type="text" id="name" class="form-control input-lg" placeholder="eg: Sean C">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Enter Competition</button>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</div>
|
||||||
</html>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user