本文整理匯總了Python中yum_distributor.distributor.YumDistributor.distributor_removed方法的典型用法代碼示例。如果您正苦於以下問題:Python YumDistributor.distributor_removed方法的具體用法?Python YumDistributor.distributor_removed怎麽用?Python YumDistributor.distributor_removed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yum_distributor.distributor.YumDistributor
的用法示例。
在下文中一共展示了YumDistributor.distributor_removed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_distributor_removed
# 需要導入模塊: from yum_distributor.distributor import YumDistributor [as 別名]
# 或者: from yum_distributor.distributor.YumDistributor import distributor_removed [as 別名]
def test_distributor_removed(self, delete_protected_repo, mock_factory):
"""
Make sure the distributor_removed() method cleans up the published files.
"""
# Create and publish repo to both http and https directories
repo = mock.Mock(spec=Repository)
repo.id = 'about_to_be_removed'
repo.working_dir = self.repo_working_dir
existing_units = self.get_units(count=5)
publish_conduit = distributor_mocks.get_publish_conduit(type_id="rpm",
existing_units=existing_units,
pkg_dir=self.pkg_dir)
config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir,
https_publish_dir=self.https_publish_dir,
http=True,
https=True)
distributor = YumDistributor()
publish_conduit.repo_id = repo.id
publish_conduit.distributor_id = 'foo'
report = distributor.publish_repo(repo, publish_conduit, config)
publishing_paths = [os.path.join(directory, repo.id) \
for directory in [self.http_publish_dir, self.https_publish_dir]]
# The publishing paths should exist
self.assertTrue(all([os.path.exists(directory) for directory in publishing_paths]))
delete_protected_repo.reset_mock()
distributor.distributor_removed(repo, config)
# Neither publishing path should exist now
self.assertFalse(all([os.path.exists(directory) for directory in publishing_paths]))
# delete_protected_repo should have been called
delete_protected_repo.assert_called_once_with(repo.id)