diff --git a/tests/app_test.py b/tests/app_test.py index 389060c..6112957 100644 --- a/tests/app_test.py +++ b/tests/app_test.py @@ -1,9 +1,15 @@ import pytest -import requests +from web import app -url = 'http://127.0.0.1:5000' # The root url of the flask app +@pytest.fixture +def client(): + app.app.config['TESTING'] = True + client = app.app.test_client() -def test_index_page(): - r = requests.get(url+'/') # Assumses that it has a path of "/" - assert r.status_code == 200 # Assumes that it will return a 200 response + yield client + +def test_root_page(client): + + rv = client.get('/') + assert b'Hello World!' in rv.data diff --git a/tests/pytest.ini b/tests/pytest.ini new file mode 100644 index 0000000..b0e5a94 --- /dev/null +++ b/tests/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore::DeprecationWarning \ No newline at end of file diff --git a/app.py b/web/app.py similarity index 100% rename from app.py rename to web/app.py