moving repository to gitea
This commit is contained in:
10
webapp/tests/db_test.py
Normal file
10
webapp/tests/db_test.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# tests/db_test.py
|
||||
# Simple test for the list_users database function
|
||||
import pytest
|
||||
from database import list_users
|
||||
|
||||
def test_list_users():
|
||||
users = list_users()
|
||||
assert isinstance(users, list)
|
||||
# Optionally, check for a known user if you have one, e.g.:
|
||||
# assert 'ADMIN' in users
|
||||
19
webapp/tests/test_app.py
Normal file
19
webapp/tests/test_app.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
from app import app
|
||||
|
||||
|
||||
# set up a test client for the Flask app.
|
||||
# configure the app for testing and provides a client to make requests.
|
||||
@pytest.fixture
|
||||
def client():
|
||||
app.config['TESTING'] = True
|
||||
with app.test_client() as client:
|
||||
yield client
|
||||
|
||||
|
||||
# test checks that the home page ('/') loads successfully
|
||||
# and contains the word 'Welcome' in the response.
|
||||
def test_home_page(client):
|
||||
response = client.get('/') # Send GET request to home page
|
||||
assert response.status_code == 200 # Page should load successfully
|
||||
assert b"Welcome" in response.data # Page should contain 'Welcome'
|
||||
Reference in New Issue
Block a user