From ff1a25710a1c8439228060d671eaf778347c66d2 Mon Sep 17 00:00:00 2001 From: alpharosto Date: Sun, 28 Apr 2024 14:11:44 +0530 Subject: [PATCH] pytest --- blogexample/app.py | 1 + tests/test_views.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/test_views.py diff --git a/blogexample/app.py b/blogexample/app.py index 7c19bbb..105f28f 100644 --- a/blogexample/app.py +++ b/blogexample/app.py @@ -5,6 +5,7 @@ from werkzeug.debug import DebuggedApplication + # from flask_ckeditor import CKEditor#, CKEditorField diff --git a/tests/test_views.py b/tests/test_views.py new file mode 100644 index 0000000..53317ee --- /dev/null +++ b/tests/test_views.py @@ -0,0 +1,19 @@ +import pytest +from flask import url_for +from ..blogexample import create_app + +@pytest.fixture +def client(): + app = create_app(debug=True) #test client for application + return app.test_client() + + +def test_index_route(client): + + response = client.get('/') #test the root route + assert response.status_code == 200 + assert b'Welcome' in response.data + + + +