This commit is contained in:
long2ice
2020-05-12 19:33:21 +08:00
parent 75e7a46e85
commit 4e7e1626aa
11 changed files with 318 additions and 121 deletions

View File

@@ -0,0 +1,27 @@
from asynctest import TestCase
from tortoise import Tortoise
from alice.backends.mysql import MysqlDDL
from tests.models import Category
TORTOISE_ORM = {
'connections': {
'default': 'mysql://root:123456@127.0.0.1:3306/test'
},
'apps': {
'models': {
'models': ['tests.models'],
'default_connection': 'default',
}
}
}
class DBTestCase(TestCase):
async def setUp(self) -> None:
await Tortoise.init(config=TORTOISE_ORM)
self.client = Tortoise.get_connection('default')
self.ddl = MysqlDDL(self.client)
async def tearDown(self) -> None:
await Tortoise.close_connections()