Added automated test coverage
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
stages:
|
stages:
|
||||||
- run
|
- test
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
run_flask_app:
|
test:
|
||||||
stage: run
|
stage: test
|
||||||
image: python:3.11
|
image: python:3.11
|
||||||
before_script:
|
before_script:
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
script:
|
script:
|
||||||
- python app.py &
|
- PYTHONPATH=. pytest --cov=. --cov-report=term-missing
|
||||||
- sleep 5
|
|
||||||
- curl http://127.0.0.1:5000
|
|
||||||
|
|
||||||
build_docker_image:
|
build_docker_image:
|
||||||
stage: build
|
stage: build
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ Jinja2==3.1.6
|
|||||||
MarkupSafe==3.0.3
|
MarkupSafe==3.0.3
|
||||||
Werkzeug==3.1.8
|
Werkzeug==3.1.8
|
||||||
psycopg2-binary==2.9.11
|
psycopg2-binary==2.9.11
|
||||||
|
pytest==8.3.5
|
||||||
|
pytest-cov==6.1.1
|
||||||
|
|||||||
11
tests/test_app.py
Normal file
11
tests/test_app.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from app import app
|
||||||
|
|
||||||
|
def test_basic():
|
||||||
|
assert True
|
||||||
|
|
||||||
|
def test_homepage():
|
||||||
|
client = app.test_client()
|
||||||
|
|
||||||
|
response = client.get("/")
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
Reference in New Issue
Block a user