本文整理汇总了Python中galaxy.managers.histories.HistoryManager.unpublish方法的典型用法代码示例。如果您正苦于以下问题:Python HistoryManager.unpublish方法的具体用法?Python HistoryManager.unpublish怎么用?Python HistoryManager.unpublish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类galaxy.managers.histories.HistoryManager
的用法示例。
在下文中一共展示了HistoryManager.unpublish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HistoryManagerTestCase
# 需要导入模块: from galaxy.managers.histories import HistoryManager [as 别名]
# 或者: from galaxy.managers.histories.HistoryManager import unpublish [as 别名]
#.........这里部分代码省略.........
self.log("should be able to make non-importable/inaccessible again")
inaccessible = self.history_manager.make_non_importable(accessible)
self.assertEqual(inaccessible, accessible)
self.assertIsNotNone(inaccessible.slug)
self.assertFalse(inaccessible.importable)
self.assertTrue(self.history_manager.is_accessible(inaccessible, owner))
self.assertFalse(self.history_manager.is_accessible(inaccessible, non_owner))
self.assertTrue(self.history_manager.is_accessible(inaccessible, self.admin_user))
def test_published(self):
owner = self.user_manager.create(**user2_data)
self.trans.set_user(owner)
non_owner = self.user_manager.create(**user3_data)
item1 = self.history_manager.create(user=owner)
self.log("should not be published by default")
self.assertFalse(item1.published)
self.assertIsNone(item1.slug)
self.log("should be able to publish (listed publicly) to all users")
published = self.history_manager.publish(item1)
self.assertEqual(published, item1)
self.assertTrue(published.published)
# note: publishing sets importable to true as well
self.assertTrue(published.importable)
self.assertIsNotNone(published.slug)
for user in self.user_manager.list():
self.assertTrue(self.history_manager.is_accessible(published, user))
self.log("should be able to make non-importable/inaccessible again")
unpublished = self.history_manager.unpublish(published)
self.assertEqual(unpublished, published)
self.assertFalse(unpublished.published)
# note: unpublishing does not make non-importable, you must explicitly do that separately
self.assertTrue(published.importable)
self.history_manager.make_non_importable(unpublished)
self.assertFalse(published.importable)
# note: slug still remains after unpublishing
self.assertIsNotNone(unpublished.slug)
self.assertTrue(self.history_manager.is_accessible(unpublished, owner))
self.assertFalse(self.history_manager.is_accessible(unpublished, non_owner))
self.assertTrue(self.history_manager.is_accessible(unpublished, self.admin_user))
def test_sharable(self):
owner = self.user_manager.create(**user2_data)
self.trans.set_user(owner)
item1 = self.history_manager.create(user=owner)
non_owner = self.user_manager.create(**user3_data)
# third_party = self.user_manager.create( **user4_data )
self.log("should be unshared by default")
self.assertEqual(self.history_manager.get_share_assocs(item1), [])
self.assertEqual(item1.slug, None)
self.log("should be able to share with specific users")
share_assoc = self.history_manager.share_with(item1, non_owner)
self.assertIsInstance(share_assoc, model.HistoryUserShareAssociation)
self.assertTrue(self.history_manager.is_accessible(item1, non_owner))
self.assertEqual(
len(self.history_manager.get_share_assocs(item1)), 1)
self.assertEqual(
示例2: HistoryManagerTestCase
# 需要导入模块: from galaxy.managers.histories import HistoryManager [as 别名]
# 或者: from galaxy.managers.histories.HistoryManager import unpublish [as 别名]
#.........这里部分代码省略.........
self.log( "should be able to make non-importable/inaccessible again" )
inaccessible = self.history_mgr.make_non_importable( self.trans, accessible )
self.assertEqual( inaccessible, accessible )
self.assertIsNotNone( inaccessible.slug )
self.assertFalse( inaccessible.importable )
self.assertTrue( self.history_mgr.is_accessible( self.trans, inaccessible, owner ) )
self.assertFalse( self.history_mgr.is_accessible( self.trans, inaccessible, non_owner ) )
self.assertTrue( self.history_mgr.is_accessible( self.trans, inaccessible, self.admin_user ) )
def test_published( self ):
owner = self.user_mgr.create( self.trans, **user2_data )
self.trans.set_user( owner )
non_owner = self.user_mgr.create( self.trans, **user3_data )
item1 = self.history_mgr.create( self.trans, user=owner )
self.log( "should not be published by default" )
self.assertFalse( item1.published )
self.assertIsNone( item1.slug )
self.log( "should be able to publish (listed publicly) to all users" )
published = self.history_mgr.publish( self.trans, item1 )
self.assertEqual( published, item1 )
self.assertTrue( published.published )
# note: publishing sets importable to true as well
self.assertTrue( published.importable )
self.assertIsNotNone( published.slug )
for user in self.user_mgr.list( self.trans ):
self.assertTrue( self.history_mgr.is_accessible( self.trans, published, user ) )
self.log( "should be able to make non-importable/inaccessible again" )
unpublished = self.history_mgr.unpublish( self.trans, published )
self.assertEqual( unpublished, published )
self.assertFalse( unpublished.published )
# note: unpublishing does not make non-importable, you must explicitly do that separately
self.assertTrue( published.importable )
self.history_mgr.make_non_importable( self.trans, unpublished )
self.assertFalse( published.importable )
# note: slug still remains after unpublishing
self.assertIsNotNone( unpublished.slug )
self.assertTrue( self.history_mgr.is_accessible( self.trans, unpublished, owner ) )
self.assertFalse( self.history_mgr.is_accessible( self.trans, unpublished, non_owner ) )
self.assertTrue( self.history_mgr.is_accessible( self.trans, unpublished, self.admin_user ) )
def test_sharable( self ):
owner = self.user_mgr.create( self.trans, **user2_data )
self.trans.set_user( owner )
item1 = self.history_mgr.create( self.trans, user=owner )
non_owner = self.user_mgr.create( self.trans, **user3_data )
#third_party = self.user_mgr.create( self.trans, **user4_data )
self.log( "should be unshared by default" )
self.assertEqual( self.history_mgr.get_share_assocs( self.trans, item1 ), [] )
self.assertEqual( item1.slug, None )
self.log( "should be able to share with specific users" )
share_assoc = self.history_mgr.share_with( self.trans, item1, non_owner )
self.assertIsInstance( share_assoc, model.HistoryUserShareAssociation )
self.assertTrue( self.history_mgr.is_accessible( self.trans, item1, non_owner ) )
self.assertEqual(
len( self.history_mgr.get_share_assocs( self.trans, item1 ) ), 1 )
self.assertEqual(