本文整理汇总了Python中pulp.server.db.model.migration_tracker.MigrationTracker.version方法的典型用法代码示例。如果您正苦于以下问题:Python MigrationTracker.version方法的具体用法?Python MigrationTracker.version怎么用?Python MigrationTracker.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.db.model.migration_tracker.MigrationTracker
的用法示例。
在下文中一共展示了MigrationTracker.version方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save
# 需要导入模块: from pulp.server.db.model.migration_tracker import MigrationTracker [as 别名]
# 或者: from pulp.server.db.model.migration_tracker.MigrationTracker import version [as 别名]
def test_save(self):
# Make sure we are starting off clean
self.assertEquals(MigrationTracker.get_collection().find({}).count(), 0)
# Instantiate a MigrationTracker
mt = MigrationTracker('meaning_of_life', 41)
# At this point there should not be a MigrationTracker in the database
self.assertEquals(mt.get_collection().find({}).count(), 0)
# saving the mt should add it to the DB
mt.save()
self.assertEquals(mt.get_collection().find({}).count(), 1)
mt_bson = mt.get_collection().find_one({'name': 'meaning_of_life'})
self.assertEquals(mt_bson['name'], 'meaning_of_life')
self.assertEquals(mt_bson['version'], 41)
# now let's update the version to 42, the correct meaning of life
mt.version = 42
mt.save()
# see if the updated meaning of life made it to the DB
self.assertEquals(mt.get_collection().find({}).count(), 1)
mt_bson = mt.get_collection().find_one({'name': 'meaning_of_life'})
self.assertEquals(mt_bson['name'], 'meaning_of_life')
self.assertEquals(mt_bson['version'], 42)