| 123456789101112131415161718192021222324252627282930313233343536373839 | import sysimport pathlibimport asyncioimport tortoisetest_file = pathlib.Path(__file__)project = test_file.parent.parentsys.path.append(str(project))import server_source as sourcefrom test import testasync def main():    modules = {        source.model.Meta.app: [ "server_source" ]    }    await tortoise.Tortoise.init(        db_url = "sqlite://:memory:",         modules = modules    )        await tortoise.Tortoise.generate_schemas()    first = await source.user_proxy.create("test", "password")    test(await first.compare_password("password"), True)    await first.result().save()    found = await source.user.filter(nick = "test").first()    found_proxy = source.user_proxy(found)        test(found.nick, "test")    test(await found_proxy.compare_password("password"), True)    await tortoise.Tortoise.close_connections()asyncio.run(main())
 |