You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
import unittest
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from admin_app.app_factory import create_app
|
|
from admin_app.core.settings import AdminSettings
|
|
|
|
|
|
class AdminAppBootstrapTests(unittest.TestCase):
|
|
def test_admin_app_root_endpoint(self):
|
|
app = create_app(AdminSettings(admin_environment="staging"))
|
|
client = TestClient(app)
|
|
|
|
response = client.get("/")
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertEqual(
|
|
response.json(),
|
|
{
|
|
"service": "orquestrador-admin",
|
|
"status": "ok",
|
|
"message": "Servico administrativo inicializado.",
|
|
"environment": "staging",
|
|
},
|
|
)
|
|
|
|
def test_admin_app_health_endpoint(self):
|
|
app = create_app(AdminSettings(admin_version="1.2.3"))
|
|
client = TestClient(app)
|
|
|
|
response = client.get("/health")
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertEqual(
|
|
response.json(),
|
|
{"service": "orquestrador-admin", "status": "ok", "version": "1.2.3"},
|
|
)
|
|
|
|
def test_admin_app_system_info_endpoint(self):
|
|
settings = AdminSettings(
|
|
admin_app_name="Admin Interno",
|
|
admin_environment="development",
|
|
admin_version="0.9.0",
|
|
admin_api_prefix="/admin",
|
|
admin_debug=True,
|
|
)
|
|
app = create_app(settings)
|
|
client = TestClient(app)
|
|
|
|
response = client.get("/admin/system/info")
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertEqual(
|
|
response.json(),
|
|
{
|
|
"service": "orquestrador-admin",
|
|
"app_name": "Admin Interno",
|
|
"environment": "development",
|
|
"version": "0.9.0",
|
|
"api_prefix": "/admin",
|
|
"debug": True,
|
|
},
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|