()
| 15 | |
| 16 | |
| 17 | async def run(): |
| 18 | await Tortoise.init( |
| 19 | { |
| 20 | "connections": { |
| 21 | "default": { |
| 22 | "engine": "tortoise.backends.asyncpg", |
| 23 | "credentials": { |
| 24 | "host": "localhost", |
| 25 | "port": "5432", |
| 26 | "user": "tortoise", |
| 27 | "password": "qwerty123", |
| 28 | "database": "test", |
| 29 | }, |
| 30 | } |
| 31 | }, |
| 32 | "apps": {"models": {"models": ["__main__"], "default_connection": "default"}}, |
| 33 | }, |
| 34 | _create_db=True, |
| 35 | ) |
| 36 | await Tortoise.generate_schemas() |
| 37 | |
| 38 | report_data = {"foo": "bar"} |
| 39 | print(await Report.create(content=report_data)) |
| 40 | print(await Report.filter(content=report_data).first()) |
| 41 | await Tortoise._drop_databases() |
| 42 | |
| 43 | |
| 44 | if __name__ == "__main__": |
no test coverage detected