本文整理汇总了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)