本文整理匯總了Python中cloudhands.common.connectors.Registry.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python Registry.delete方法的具體用法?Python Registry.delete怎麽用?Python Registry.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cloudhands.common.connectors.Registry
的用法示例。
在下文中一共展示了Registry.delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_delete_organisation_removes_subscription
# 需要導入模塊: from cloudhands.common.connectors import Registry [as 別名]
# 或者: from cloudhands.common.connectors.Registry import delete [as 別名]
def test_delete_organisation_removes_subscription(self):
session = Registry().connect(sqlite3, ":memory:").session
archive = session.query(Archive).filter(
Archive.name == "NITS").first()
self.assertTrue(archive)
org = session.query(Organisation).one()
subs = Subscription(
uuid=uuid.uuid4().hex,
model=cloudhands.common.__version__,
organisation=org, provider=archive)
session.add(subs)
session.commit()
self.assertEqual(1, len(org.subscriptions))
session.delete(org)
session.commit()
self.assertEqual(0, session.query(Organisation).count())
self.assertEqual(0, session.query(Subscription).count())