| import pytest |
| from app import app |
|
|
|
|
| @pytest.fixture |
| def client(): |
| app.config.update({"TESTING": True}) |
| with app.test_client() as client: |
| yield client |
|
|
|
|
| def test_index_page(client): |
| resp = client.get("/") |
| assert resp.status_code == 200 |
| assert b"Komoditas logam" in resp.data |
|
|
|
|
| def test_predict_invalid(client): |
| resp = client.post("/predict", data={"commodity": "unknownmetal"}, follow_redirects=True) |
| assert resp.status_code == 200 |
| |
| assert b"Tidak menemukan simbol" in resp.data or b"Data historis" in resp.data |
|
|
|
|
| |
| import re |
|
|
|
|
| def test_ascii_titles(): |
| with open("templates/base.html", "r", encoding="utf-8") as f: |
| html = f.read() |
| |
| assert "\u2022" not in html |
| |