This commit is contained in:
parent
6ab583af33
commit
d015451e55
3 changed files with 11 additions and 3 deletions
4
app.py
4
app.py
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""Creatr App"""
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def hello():
|
def index():
|
||||||
|
"""Show index page"""
|
||||||
return "Hello Fediverse!"
|
return "Hello Fediverse!"
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""Build test fixture"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from app import app as flask_app
|
from app import app as flask_app
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture(name="app")
|
||||||
def app():
|
def fixture_app():
|
||||||
|
"""Build flask app"""
|
||||||
yield flask_app
|
yield flask_app
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def client(app):
|
def client(app):
|
||||||
|
"""Build test client"""
|
||||||
return app.test_client()
|
return app.test_client()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""Test App index"""
|
||||||
|
|
||||||
def test_request_example(client):
|
def test_request_example(client):
|
||||||
|
"""Test index path"""
|
||||||
response = client.get("/")
|
response = client.get("/")
|
||||||
assert b"Hello Fediverse!" in response.data
|
assert b"Hello Fediverse!" in response.data
|
||||||
|
|
Loading…
Reference in a new issue