beer/tests/test_beer.py
kleph ff6c1f586e
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
[tests] Test parameters passed in URL
Fixes #7
2020-03-03 00:40:32 +01:00

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