本文整理匯總了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()