A Python port of the Invisible Internet Project (I2P)
1"""Tests for console app factory — TDD: tests before implementation."""
2
3import pytest
4from i2p_apps.console.app import create_app
5
6
7class TestAppFactory:
8 def test_create_app(self):
9 app = create_app()
10 assert app is not None
11 assert app.name == "i2p_apps.console.app"
12
13 def test_create_app_returns_flask(self):
14 app = create_app()
15 from flask import Flask
16 assert isinstance(app, Flask)
17
18 def test_health_endpoint(self):
19 app = create_app()
20 client = app.test_client()
21 resp = client.get("/health")
22 assert resp.status_code == 200
23 data = resp.get_json()
24 assert data["status"] == "ok"
25
26 def test_jinja2_configured(self):
27 app = create_app()
28 assert app.jinja_env is not None
29
30 def test_custom_config(self):
31 app = create_app({"TESTING": True})
32 assert app.config["TESTING"] is True