本文整理匯總了Python中iso_distributor.distributor.ISODistributor.validate_config方法的典型用法代碼示例。如果您正苦於以下問題:Python ISODistributor.validate_config方法的具體用法?Python ISODistributor.validate_config怎麽用?Python ISODistributor.validate_config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iso_distributor.distributor.ISODistributor
的用法示例。
在下文中一共展示了ISODistributor.validate_config方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_validate_config_iso_prefix
# 需要導入模塊: from iso_distributor.distributor import ISODistributor [as 別名]
# 或者: from iso_distributor.distributor.ISODistributor import validate_config [as 別名]
def test_validate_config_iso_prefix(self):
repo = mock.Mock(spec=Repository)
repo.id = "testrepo"
distributor = ISODistributor()
# test invalid iso prefix
config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="my_iso*_name_/")
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
# test valid iso prefix
config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="My_iso_name-01")
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
示例2: test_validate_config
# 需要導入模塊: from iso_distributor.distributor import ISODistributor [as 別名]
# 或者: from iso_distributor.distributor.ISODistributor import validate_config [as 別名]
def test_validate_config(self):
"""
Test the validate_config method in ISODistributor, which just hands the config off to a helper
method in export_utils
"""
# Setup
validate_config = export_utils.validate_export_config
export_utils.validate_export_config = mock.MagicMock()
distributor = ISODistributor()
# Test. All validate_config should do is hand the config argument to the export_utils validator
distributor.validate_config(None, 'config', None)
export_utils.validate_export_config.assert_called_once_with('config')
# Clean up
export_utils.validate_export_config = validate_config
示例3: test_validate_config
# 需要導入模塊: from iso_distributor.distributor import ISODistributor [as 別名]
# 或者: from iso_distributor.distributor.ISODistributor import validate_config [as 別名]
def test_validate_config(self):
distributor = ISODistributor()
repo = mock.Mock(spec=Repository)
repo.id = "testrepo"
http = "true"
https = False
config = distributor_mocks.get_basic_config(http=http, https=https)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
http = True
config = distributor_mocks.get_basic_config(http=http, https=https)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
http = True
https = "False"
relative_url = "test_path"
config = distributor_mocks.get_basic_config(http=http, https=https)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
https = True
config = distributor_mocks.get_basic_config(http=http, https=https)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
http = True
https = False
relative_url = "test_path"
skip_content_types = "fake"
config = distributor_mocks.get_basic_config(http=http, https=https,
skip=skip_content_types)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
skip_content_types = []
config = distributor_mocks.get_basic_config(http=http, https=https,
skip=skip_content_types)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
# test invalid iso prefix
config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="my_iso*_name_/")
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
# test valid iso prefix
config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="My_iso_name-01")
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
invalid_config="dummy"
config = distributor_mocks.get_basic_config(invalid_config)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
http_publish_dir = self.http_publish_dir
config = distributor_mocks.get_basic_config(http=http, https=https,
http_publish_dir=http_publish_dir)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
http_publish_dir = "test"
config = distributor_mocks.get_basic_config(http=http, https=https,
http_publish_dir=http_publish_dir)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
https_publish_dir = self.https_publish_dir
config = distributor_mocks.get_basic_config(http=http, https=https,
https_publish_dir=https_publish_dir)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)
https_publish_dir = "test"
config = distributor_mocks.get_basic_config(http=http, https=https,
https_publish_dir=https_publish_dir)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
if not M2CRYPTO_HAS_CRL_SUPPORT:
return
http = True
https = False
relative_url = "test_path"
auth_cert = "fake"
config = distributor_mocks.get_basic_config(http=http, https=https,
https_ca=auth_cert)
state, msg = distributor.validate_config(repo, config, [])
self.assertFalse(state)
auth_cert = open(os.path.join(self.data_dir, "cert.crt")).read()
config = distributor_mocks.get_basic_config(http=http, https=https,
https_ca=auth_cert)
state, msg = distributor.validate_config(repo, config, [])
self.assertTrue(state)