@@ -33,32 +33,30 @@ def litestar_config() -> LitestarConfig:
3333def test_litestar_bootstrap (litestar_config : LitestarConfig ) -> None :
3434 bootstrapper = LitestarBootstrapper (bootstrap_config = litestar_config )
3535 application = bootstrapper .bootstrap ()
36-
37- try :
38- logger .info ("testing logging" , key = "value" )
39-
40- assert application .cors_config
41- assert application .cors_config .allow_origins == litestar_config .cors_allowed_origins
42-
43- with TestClient (app = application ) as test_client :
44- response = test_client .get (litestar_config .health_checks_path )
45- assert response .status_code == status_codes .HTTP_200_OK
46- assert response .json () == {
47- "health_status" : True ,
48- "service_name" : "microservice" ,
49- "service_version" : "2.0.0" ,
50- }
51-
52- response = test_client .get (litestar_config .prometheus_metrics_path )
53- assert response .status_code == status_codes .HTTP_200_OK
54- assert response .text
55-
56- response = test_client .get (litestar_config .swagger_path )
57- assert response .status_code == status_codes .HTTP_200_OK
58- response = test_client .get (f"{ litestar_config .service_static_path } /swagger-ui.css" )
59- assert response .status_code == status_codes .HTTP_200_OK
60- finally :
61- bootstrapper .teardown ()
36+ assert bootstrapper .is_bootstrapped
37+ logger .info ("testing logging" , key = "value" )
38+ assert application .cors_config
39+ assert application .cors_config .allow_origins == litestar_config .cors_allowed_origins
40+
41+ with TestClient (app = application ) as test_client :
42+ response = test_client .get (litestar_config .health_checks_path )
43+ assert response .status_code == status_codes .HTTP_200_OK
44+ assert response .json () == {
45+ "health_status" : True ,
46+ "service_name" : "microservice" ,
47+ "service_version" : "2.0.0" ,
48+ }
49+
50+ response = test_client .get (litestar_config .prometheus_metrics_path )
51+ assert response .status_code == status_codes .HTTP_200_OK
52+ assert response .text
53+
54+ response = test_client .get (litestar_config .swagger_path )
55+ assert response .status_code == status_codes .HTTP_200_OK
56+ response = test_client .get (f"{ litestar_config .service_static_path } /swagger-ui.css" )
57+ assert response .status_code == status_codes .HTTP_200_OK
58+
59+ assert not bootstrapper .is_bootstrapped
6260
6361
6462def test_litestar_bootstrapper_not_ready () -> None :
0 commit comments