本文整理汇总了Python中domogik.common.database.DbHelper.get_url_connection_string方法的典型用法代码示例。如果您正苦于以下问题:Python DbHelper.get_url_connection_string方法的具体用法?Python DbHelper.get_url_connection_string怎么用?Python DbHelper.get_url_connection_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类domogik.common.database.DbHelper
的用法示例。
在下文中一共展示了DbHelper.get_url_connection_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from domogik.common.database import DbHelper [as 别名]
# 或者: from domogik.common.database.DbHelper import get_url_connection_string [as 别名]
for user in l_user:
assert user.login != 'domo'
person1_id = person1.id
person_del = db.del_person(person1.id)
assert person_del.id == person1_id
assert len(db.list_persons()) == 2
assert len(db.list_user_accounts()) == 1
try:
db.del_person(12345678910)
TestCase.fail(self, "Person does not exist, an exception should have been raised")
except DbHelperException:
pass
try:
db.del_user_account(12345678910)
TestCase.fail(self, "User account does not exist, an exception should have been raised")
except DbHelperException:
pass
if __name__ == "__main__":
print("Creating test database...")
db = DbHelper(use_test_db=True)
url = db.get_url_connection_string()
test_url = '%s_test' % url
engine_test = create_engine(test_url)
sql_schema.metadata.reflect(engine_test)
sql_schema.metadata.drop_all(engine_test)
sql_schema.metadata.create_all(engine_test)
print("*** Using database %s ***\n" % db.get_db_type())
unittest.main()