diff --git a/blogexample/migrations/versions/__pycache__/29d9055c6a28_create_add_url_field_in_posts_model.cpython-36.pyc b/blogexample/migrations/versions/__pycache__/29d9055c6a28_create_add_url_field_in_posts_model.cpython-36.pyc index 4fecab9..963923c 100644 Binary files a/blogexample/migrations/versions/__pycache__/29d9055c6a28_create_add_url_field_in_posts_model.cpython-36.pyc and b/blogexample/migrations/versions/__pycache__/29d9055c6a28_create_add_url_field_in_posts_model.cpython-36.pyc differ diff --git a/blogexample/migrations/versions/__pycache__/5deb590e2e6e_create_posts_table.cpython-36.pyc b/blogexample/migrations/versions/__pycache__/5deb590e2e6e_create_posts_table.cpython-36.pyc index 46ad929..b5cc132 100644 Binary files a/blogexample/migrations/versions/__pycache__/5deb590e2e6e_create_posts_table.cpython-36.pyc and b/blogexample/migrations/versions/__pycache__/5deb590e2e6e_create_posts_table.cpython-36.pyc differ diff --git a/blogexample/templates/posts.html b/blogexample/templates/posts.html index 5e3b162..e02ec66 100644 --- a/blogexample/templates/posts.html +++ b/blogexample/templates/posts.html @@ -7,35 +7,40 @@
{{ each_post.body|safe }}
diff --git a/lib/__pycache__/util_datetime.cpython-36.pyc b/lib/__pycache__/util_datetime.cpython-36.pyc index a0f6804..22dcc7c 100644 Binary files a/lib/__pycache__/util_datetime.cpython-36.pyc and b/lib/__pycache__/util_datetime.cpython-36.pyc differ diff --git a/lib/__pycache__/util_sqlalchemy.cpython-36.pyc b/lib/__pycache__/util_sqlalchemy.cpython-36.pyc index f9874a6..b91fd96 100644 Binary files a/lib/__pycache__/util_sqlalchemy.cpython-36.pyc and b/lib/__pycache__/util_sqlalchemy.cpython-36.pyc differ diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..00b0c1e --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +pythonpath = . +addopts = --maxfail=1 --disable-warnings -v diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..40ef36d --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +import pytest +from blogexample.app import create_app # Adjust to your actual app location + +@pytest.fixture +def app(): + app = create_app() # If your app creation function is called create_app + yield app + +@pytest.fixture +def client(app): + return app.test_client() diff --git a/tests/test_routes.py b/tests/test_routes.py new file mode 100644 index 0000000..63d383a --- /dev/null +++ b/tests/test_routes.py @@ -0,0 +1,4 @@ +def test_home_route_status_code(client): + """Test the status code of the posts route""" + response = client.get('/posts') + assert response.status_code == 200