28 lines
798 B
Python
28 lines
798 B
Python
import pytest
|
|
from src.main import app
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
app.testing = True
|
|
with app.test_client() as client:
|
|
yield client
|
|
|
|
def test_about_page_status_and_content(client):
|
|
response = client.get('/about')
|
|
assert response.status_code == 200
|
|
assert b'O projekcie' in response.data
|
|
|
|
def test_contact_page_get(client):
|
|
response = client.get('/contact')
|
|
assert response.status_code == 200
|
|
assert b'<form' in response.data
|
|
assert b'name="name"' in response.data
|
|
|
|
def test_contact_page_post(client):
|
|
response = client.post('/contact', data={
|
|
'name': 'Tester',
|
|
'message': 'To jest test.'
|
|
}, follow_redirects=True)
|
|
assert response.status_code == 200
|
|
assert b'Dzi' in response.data # fragment "Dziękujemy za kontakt!"
|