Updated tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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: <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_bootstrap import Bootstrap
|
||||
import sqlite3
|
||||
import os
|
||||
import string
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
Bootstrap(app)
|
||||
|
||||
|
||||
def get_db_connection():
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Wigan Homebrew Club Competition Entry</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Wigan Homebrew Club Competition Entry</h1>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
{% extends "bootstrap/base.html" %}
|
||||
{% block title %}Wigan Homebrew Club Competition Entry{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="jumbotron text-center">
|
||||
<h2>Wigan Homebrew Club Competition Entry</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<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>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Wigan Homebrew Club Competition Entry</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Wigan Homebrew Club Competition Entry</h1>
|
||||
<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>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>
|
||||
<form action="{{ url_for('generate') }}" method="POST">
|
||||
<label for="name">Please enter your name and initial (eg: Sean C):</label>
|
||||
<input name="name" type="text" id="name"><br>
|
||||
<button type="submit">Enter Competition</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
{% extends "bootstrap/base.html" %}
|
||||
{% block title %}Wigan Homebrew Club Competition Entry{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="jumbotron text-center">
|
||||
<h2>Wigan Homebrew Club Competition Entry</h2>
|
||||
</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>
|
||||
<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>
|
||||
<hr>
|
||||
<form action="{{ url_for('generate') }}" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="name">Please enter your first name and initial (or nickname)</label>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user