36 lines
821 B
Python
36 lines
821 B
Python
# pylint: disable=no-name-in-module, redefined-outer-name
|
|
""" Unit tests """
|
|
|
|
import pytest
|
|
|
|
from beer import beer
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
""" create flask app """
|
|
|
|
beer.app.config['TESTING'] = True
|
|
with beer.app.test_client() as client:
|
|
yield client
|
|
|
|
|
|
def test_slash(client):
|
|
"""Test wiwth no param"""
|
|
|
|
response = client.get('/')
|
|
assert response.status_code == 200
|
|
assert b'<title>beer</title>' in response.data
|
|
|
|
def test_parameters(client):
|
|
"""Test wiwth no param"""
|
|
|
|
hours = '18'
|
|
minutes = '30'
|
|
response = client.get('/'+hours)
|
|
assert response.status_code == 200
|
|
assert b'<title>beer</title>' in response.data
|
|
|
|
response = client.get('/'+hours+'/'+minutes)
|
|
assert response.status_code == 200
|
|
assert b'<title>beer</title>' in response.data
|