Test Cases — Aquilia Documentation
Comprehensive guide and documentation for Test Cases in the Aquilia framework. View API reference, examples, and implementation patterns.
Testing / Test Cases Test Case Classes Aquilia features a set of test case subclasses tailored for various degrees of infrastructure dependency. These base classes automate uvicorn starting/stopping, manage database transaction rollbacks, and expose testing properties. Test Case Hierarchy Choose the appropriate test class depending on your test scope to maximize execution speed and correctness: , , , ].map((tc, i) => ( ))} Lifecycle & Configurations For AquiliaTestCase and its subclasses, you configure dependencies and subsystem integrations using class-level attributes: Attribute Type Purpose ))} from aquilia.testing import AquiliaTestCase from myapp.manifests import api_manifest class TestBillingFlows(AquiliaTestCase): manifests = [api_manifest] enable_cache = True enable_auth = True settings = , "cache": } async def test_checkout(self): # Cache and Auth systems are automatically active here ... Test Properties & Helpers When running AquiliaTestCase , several properties and helper methods are exposed on the class instance: Instance Properties di_container: Direct access to the active Container instance of the test server, letting you manually resolve or check dependencies. fault_engine: Reference to the running FaultEngine (or MockFaultEngine). config: The active config loader reference. controller_router: The route table resolver, containing all registered HTTP paths. cache_service: Exposes the running cache manager if enable_cache=True. Utility Methods get_url(route_name, **params): Resolves a named controller route pattern back into an absolute URI path (e.g. self.get_url("get_user", id="123") yields "/users/123"). login(username, password): Convenience helper that issues a POST to /auth/login containing credentials, returning the HTTP response. )
Go to Homepage