Add the first test

It just checks if the index page has a specific sentence.  But at least it’s now possible to
create tests.
This commit is contained in:
2018-07-10 12:05:03 +02:00
parent 4c65644291
commit 0595a28535
4 changed files with 80 additions and 4 deletions

24
tests/test_calsocial.py Normal file
View File

@@ -0,0 +1,24 @@
import pytest
import calsocial
from calsocial.models import db
@pytest.fixture
def client():
calsocial.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'
calsocial.app.config['TESTING'] = True
client = calsocial.app.test_client()
with calsocial.app.app_context():
db.create_all()
yield client
def test_index_no_login(client):
"""Test the main page without logging in
"""
page = client.get('/')
assert b'Welcome to Calendar.social' in page.data