當前位置: 首頁>>代碼示例>>Python>>正文


Python ISODistributor.validate_config方法代碼示例

本文整理匯總了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)
開發者ID:jlsherrill,項目名稱:pulp,代碼行數:14,代碼來源:test_iso_distributor.py

示例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
開發者ID:jdob,項目名稱:pulp_rpm,代碼行數:18,代碼來源:test_export_distributor.py

示例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)
開發者ID:ehelms,項目名稱:pulp_rpm,代碼行數:98,代碼來源:test_iso_distributor.py


注:本文中的iso_distributor.distributor.ISODistributor.validate_config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。