initial creation
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import pytest
|
||||
|
||||
from snakeeyes.app import create_app
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope='session')
|
||||
def app():
|
||||
"""
|
||||
Setup our flask test app, this only gets executed once.
|
||||
|
||||
:return: Flask app
|
||||
"""
|
||||
params = {
|
||||
'DEBUG': False,
|
||||
'TESTING': True,
|
||||
}
|
||||
|
||||
_app = create_app(settings_override=params)
|
||||
|
||||
# Establish an application context before running the tests.
|
||||
ctx = _app.app_context()
|
||||
ctx.push()
|
||||
|
||||
yield _app
|
||||
|
||||
ctx.pop()
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope='function')
|
||||
def client(app):
|
||||
"""
|
||||
Setup an app client, this gets executed for each test function.
|
||||
|
||||
:param app: Pytest fixture
|
||||
:return: Flask app client
|
||||
"""
|
||||
yield app.test_client()
|
||||
@@ -0,0 +1,18 @@
|
||||
from flask import url_for
|
||||
|
||||
|
||||
class TestPage(object):
|
||||
def test_home_page(self, client):
|
||||
""" Home page should respond with a success 200. """
|
||||
response = client.get(url_for('page.home'))
|
||||
assert response.status_code == 200
|
||||
|
||||
def test_terms_page(self, client):
|
||||
""" Terms page should respond with a success 200. """
|
||||
response = client.get(url_for('page.terms'))
|
||||
assert response.status_code == 200
|
||||
|
||||
def test_privacy_page(self, client):
|
||||
""" Privacy page should respond with a success 200. """
|
||||
response = client.get(url_for('page.privacy'))
|
||||
assert response.status_code == 200
|
||||
Reference in New Issue
Block a user