-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_cookietemple_website.py
44 lines (29 loc) · 1.1 KB
/
test_cookietemple_website.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
"""Tests for `cookietemple_website` package."""
import pytest
from flask import Flask
from cookietemple_website.config import Config
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_content(response):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
def create_test_app():
app = Flask(__name__)
app.config.from_object(Config)
from cookietemple_website.errors import bp as errors_bp # noqa: E402
app.register_blueprint(errors_bp)
from cookietemple_website.routes import bp as basic_bp
app.register_blueprint(basic_bp)
return app
def test_redirect():
flask_app = create_test_app()
testing_client = flask_app.test_client()
response = testing_client.get('/')
assert response.status_code == 302 # assert redirecting