• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python configuration.validate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pulp_rpm.plugins.importers.iso_importer.configuration.validate函数的典型用法代码示例。如果您正苦于以下问题:Python validate函数的具体用法?Python validate怎么用?Python validate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了validate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_required_when_other_parameters_are_present

 def test_required_when_other_parameters_are_present(self):
     for parameters in [
         {importer_constants.KEY_MAX_SPEED: '1024'}, {importer_constants.KEY_MAX_DOWNLOADS: 2},
         {importer_constants.KEY_PROXY_PASS: 'flock_of_seagulls',
          importer_constants.KEY_PROXY_USER: 'big_kahuna_burger',
          importer_constants.KEY_PROXY_HOST: 'http://test.com'},
         {importer_constants.KEY_PROXY_HOST: 'http://test.com', importer_constants.KEY_PROXY_PORT: '3037'},
         {importer_constants.KEY_PROXY_HOST: 'http://test.com'},
         {importer_constants.KEY_UNITS_REMOVE_MISSING: True},
         {importer_constants.KEY_SSL_CA_CERT: 'cert'},
         {importer_constants.KEY_SSL_CLIENT_CERT: 'cert'},
         {importer_constants.KEY_SSL_CLIENT_CERT: 'cert', importer_constants.KEY_SSL_CLIENT_KEY: 'key'},
         {importer_constants.KEY_VALIDATE: True}]:
             # Each of the above configurations should cause the validator to complain about the feed_url
             # missing
             config = importer_mocks.get_basic_config(**parameters)
             status, error_message = configuration.validate(config)
             self.assertTrue(status is False)
             self.assertEqual(
                 error_message,
                 'The configuration parameter <%(feed)s> is required when any of the following other '
                 'parameters are defined: %(max_speed)s, %(num_threads)s, %(proxy_pass)s, %(proxy_port)s, '
                 '%(proxy_host)s, %(proxy_user)s, %(remove_missing_units)s, %(ssl_ca_cert)s, '
                 '%(ssl_client_cert)s, %(ssl_client_key)s, %(validate_units)s.' % {
                     'feed': importer_constants.KEY_FEED, 'max_speed': importer_constants.KEY_MAX_SPEED,
                     'num_threads': importer_constants.KEY_MAX_DOWNLOADS,
                     'proxy_pass': importer_constants.KEY_PROXY_PASS,
                     'proxy_port': importer_constants.KEY_PROXY_PORT,
                     'proxy_host': importer_constants.KEY_PROXY_HOST,
                     'proxy_user': importer_constants.KEY_PROXY_USER,
                     'remove_missing_units': importer_constants.KEY_UNITS_REMOVE_MISSING,
                     'ssl_ca_cert': importer_constants.KEY_SSL_CA_CERT,
                     'ssl_client_cert': importer_constants.KEY_SSL_CLIENT_CERT,
                     'ssl_client_key': importer_constants.KEY_SSL_CLIENT_KEY,
                     'validate_units': importer_constants.KEY_VALIDATE})
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:35,代码来源:test_iso_importer_configuration.py


示例2: test_zero

 def test_zero(self):
     config = importer_mocks.get_basic_config(**{constants.CONFIG_NUM_THREADS: 0,
                                                 constants.CONFIG_FEED_URL: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <num_threads> must be set to a positive '
                                     'integer, but is currently set to <0>.')
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例3: test_invalid_config

 def test_invalid_config(self):
     config = importer_mocks.get_basic_config(**{importer_constants.KEY_MAX_SPEED: -1.0,
                                                 importer_constants.KEY_FEED: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <max_speed> must be set to a positive '
                                     'numerical value, but is currently set to <-1.0>.')
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例4: test_validate

 def test_validate(self):
     parameters = {constants.CONFIG_PROXY_PORT: 8088, constants.CONFIG_PROXY_URL: 'http://proxy.com',
                   constants.CONFIG_FEED_URL: 'http://test.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is True)
     self.assertEqual(error_message, None)
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例5: test_client_cert_is_non_string

 def test_client_cert_is_non_string(self):
     config = importer_mocks.get_basic_config(**{importer_constants.KEY_SSL_CLIENT_CERT: 8,
                                                 importer_constants.KEY_FEED: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, "The configuration parameter <ssl_client_cert> should be a string, "
                                     "but it was <type 'int'>.")
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例6: test_invalid_config

 def test_invalid_config(self):
     config = importer_mocks.get_basic_config(**{constants.CONFIG_VALIDATE_DOWNLOADS: 1,
                                                 constants.CONFIG_FEED_URL: 'http://feed.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <validate_downloads> must be set to a '
                                     'boolean value, but is currently set to <1>.')
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例7: test_client_key_requires_client_cert

 def test_client_key_requires_client_cert(self):
     config = importer_mocks.get_basic_config(**{importer_constants.KEY_SSL_CLIENT_KEY: 'Client Key!',
                                                 importer_constants.KEY_FEED: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <ssl_client_key> requires the '
                                     '<ssl_client_cert> parameter to also be set.')
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例8: test_url_is_non_string

 def test_url_is_non_string(self):
     config = importer_mocks.get_basic_config(**{constants.CONFIG_PROXY_URL: 7,
                                                 constants.CONFIG_FEED_URL: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, "The configuration parameter <proxy_url> should be a string, "
                                     "but it was <type 'int'>.")
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例9: test_validate

 def test_validate(self):
     config = importer_mocks.get_basic_config(
         **{importer_constants.KEY_FEED: "http://test.com/feed", importer_constants.KEY_MAX_SPEED: 56.6,
            importer_constants.KEY_MAX_DOWNLOADS: 3})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is True)
     self.assertEqual(error_message, None)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例10: test_validate_str

 def test_validate_str(self):
     parameters = {importer_constants.KEY_PROXY_PORT: '3128', importer_constants.KEY_PROXY_HOST: 'http://test.com',
                   importer_constants.KEY_FEED: 'http://test.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is True)
     self.assertEqual(error_message, None)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_iso_importer_configuration.py


示例11: test_client_key_is_non_string

 def test_client_key_is_non_string(self):
     params = {constants.CONFIG_SSL_CLIENT_KEY: 9, constants.CONFIG_SSL_CLIENT_CERT: 'cert!',
               constants.CONFIG_FEED_URL: 'http://test.com'}
     config = importer_mocks.get_basic_config(**params)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, "The configuration parameter <ssl_client_key> should be a string, "
                                     "but it was <type 'int'>.")
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:8,代码来源:test_iso_importer_configuration.py


示例12: test_username_requires_password

 def test_username_requires_password(self):
     parameters = {constants.CONFIG_PROXY_USER: 'the_dude', constants.CONFIG_FEED_URL: 'http://fake.com',
                   constants.CONFIG_PROXY_URL: 'http://fake.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <proxy_user> requires the '
                                     '<proxy_password> parameter to also be set.')
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:8,代码来源:test_iso_importer_configuration.py


示例13: test_zero

 def test_zero(self):
     parameters = {importer_constants.KEY_PROXY_PORT: 0, importer_constants.KEY_PROXY_HOST: 'http://test.com',
                   importer_constants.KEY_FEED: 'http://test.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <proxy_port> must be set to a positive '
                                     'integer, but is currently set to <0>.')
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:8,代码来源:test_iso_importer_configuration.py


示例14: test_password_is_non_string

 def test_password_is_non_string(self):
     parameters = {importer_constants.KEY_PROXY_PASS: 7, importer_constants.KEY_PROXY_USER: "the_dude",
                   importer_constants.KEY_FEED: 'http://test.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, "The configuration parameter <proxy_password> should be a string, "
                                     "but it was <type 'int'>.")
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:8,代码来源:test_iso_importer_configuration.py


示例15: test_float

 def test_float(self):
     parameters = {constants.CONFIG_PROXY_PORT: math.pi, constants.CONFIG_PROXY_URL: 'http://test.com',
                   constants.CONFIG_FEED_URL: 'http://test.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, 'The configuration parameter <proxy_port> must be set to a positive '
                                     'integer, but is currently set to <%s>.'%math.pi)
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:8,代码来源:test_iso_importer_configuration.py


示例16: test_username_is_non_string

 def test_username_is_non_string(self):
     parameters = {constants.CONFIG_PROXY_PASSWORD: 'bowling', constants.CONFIG_PROXY_USER: 185,
                   constants.CONFIG_PROXY_URL: 'http://test.com',
                   constants.CONFIG_FEED_URL: 'http://test2.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     self.assertEqual(error_message, "The configuration parameter <proxy_user> should be a string, "
                                     "but it was <type 'int'>.")
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:9,代码来源:test_iso_importer_configuration.py


示例17: test_url_is_non_string

 def test_url_is_non_string(self):
     config = importer_mocks.get_basic_config(**{importer_constants.KEY_PROXY_HOST: 7,
                                                 importer_constants.KEY_FEED: 'http://test.com'})
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     expected_message = ("The configuration parameter <%(proxy_host)s> should be a string, but it was "
                         "<type 'int'>.")
     expected_message = expected_message % {'proxy_host': importer_constants.KEY_PROXY_HOST}
     self.assertEqual(error_message, expected_message)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:9,代码来源:test_iso_importer_configuration.py


示例18: test_username_requires_password

 def test_username_requires_password(self):
     parameters = {importer_constants.KEY_PROXY_USER: 'the_dude', importer_constants.KEY_FEED: 'http://fake.com',
                   importer_constants.KEY_PROXY_HOST: 'http://fake.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     expected_message = ('The configuration parameter <%(proxy_user)s> requires the '
                         '<%(proxy_pass)s> parameter to also be set.')
     expected_message = expected_message % {'proxy_user': importer_constants.KEY_PROXY_USER,
                                            'proxy_pass': importer_constants.KEY_PROXY_PASS}
     self.assertEqual(error_message, expected_message)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:11,代码来源:test_iso_importer_configuration.py


示例19: test_username_is_non_string

 def test_username_is_non_string(self):
     parameters = {importer_constants.KEY_PROXY_PASS: 'bowling', importer_constants.KEY_PROXY_USER: 185,
                   importer_constants.KEY_PROXY_HOST: 'http://test.com',
                   importer_constants.KEY_FEED: 'http://test2.com'}
     config = importer_mocks.get_basic_config(**parameters)
     status, error_message = configuration.validate(config)
     self.assertTrue(status is False)
     expected_message = ("The configuration parameter <%(proxy_user)s> should be a string, but it was "
                         "<type 'int'>.")
     expected_message = expected_message % {'proxy_user': importer_constants.KEY_PROXY_USER}
     self.assertEqual(error_message, expected_message)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:11,代码来源:test_iso_importer_configuration.py


示例20: test_required_when_other_parameters_are_present

 def test_required_when_other_parameters_are_present(self):
     for parameters in [
         {constants.CONFIG_PROXY_PASSWORD: 'flock_of_seagulls',
          constants.CONFIG_PROXY_USER: 'big_kahuna_burger', constants.CONFIG_FEED_URL: 'http://fake.com'},
         {constants.CONFIG_PROXY_PORT: '3037', constants.CONFIG_FEED_URL: 'http://fake.com'}]:
             # Each of the above configurations should cause the validator to complain about the proxy_url
             # missing
             config = importer_mocks.get_basic_config(**parameters)
             status, error_message = configuration.validate(config)
             self.assertTrue(status is False)
             self.assertEqual(
                 error_message,
                 'The configuration parameter <proxy_url> is required when any of the following other '
                 'parameters are defined: proxy_password, proxy_port, proxy_user')
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:14,代码来源:test_iso_importer_configuration.py



注:本文中的pulp_rpm.plugins.importers.iso_importer.configuration.validate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python nectar_factory.create_downloader函数代码示例发布时间:2022-05-25
下一篇:
Python configuration.validate函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap