def test_server_url_missing_host_and_path(self): config = { constants.CONFIG_KEY_REDIRECT_URL: 'http://' } assert_validation_exception(configuration.validate_config, [error_codes.DKR1002, error_codes.DKR1003], config)
def test_configuration_protected_bad_str(self): config = PluginCallConfiguration({ constants.CONFIG_KEY_PROTECTED: 'apple' }, {}) repo = Mock(id='ofatowncalledbellaire') assert_validation_exception(configuration.validate_config, [error_codes.DKR1004], config, repo)
def test_server_url_missing_scheme(self): config = { constants.CONFIG_KEY_REDIRECT_URL: 'www.pulpproject.org/foo' } assert_validation_exception(configuration.validate_config, [error_codes.DKR1001, error_codes.DKR1002], config)
def test_server_url_missing_host_and_path(self): config = { constants.CONFIG_KEY_REDIRECT_URL: 'http://' } repo = Mock(id='upsidedown') assert_validation_exception(configuration.validate_config, [error_codes.DKR1002, error_codes.DKR1003], config, repo)
def test_server_url_missing_scheme(self): config = { constants.CONFIG_KEY_REDIRECT_URL: 'www.pulpproject.org/foo' } repo = Mock(id='andidliketotakeaminute') assert_validation_exception(configuration.validate_config, [error_codes.DKR1001, error_codes.DKR1002], config, repo)
def test_repo_regisrty_id_with_multiple_slashes(self): """ We need to allow only one slash. """ config = PluginCallConfiguration( {constants.CONFIG_KEY_REPO_REGISTRY_ID: 'slashes/ok/notok'}, {}) repo = Mock(id='repoid') assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config, repo)
def test_create_invalid_consumer_id(self): group_id = 'create_consumer_group' # Add one valid consumer self._create_consumer('test_consumer') util.assert_validation_exception(self.manager.create_consumer_group, [error_codes.PLP1001], group_id, consumer_ids=['test_consumer', 'bad1']) group = self.collection.find_one({'id': group_id}) self.assertFalse(group is not None)
def test_repo_regisrty_id_with_multiple_slashes(self): """ We need to allow only one slash. """ config = PluginCallConfiguration({ constants.CONFIG_KEY_REPO_REGISTRY_ID: 'slashes/ok/notok' }, {}) repo = Mock(id='repoid') assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config, repo)
def test_invalid_repo_registry_id(self): config = PluginCallConfiguration( {constants.CONFIG_KEY_REPO_REGISTRY_ID: 'noUpperCase'}, {}) repo = Mock(id='repoid') assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config, repo) config2 = PluginCallConfiguration( {constants.CONFIG_KEY_REPO_REGISTRY_ID: 'Nouppsercase'}, {}) assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config2, repo)
def test_create_invalid_consumer_id(self): group_id = 'create_consumer_group' # Add one valid consumer self._create_consumer('test_consumer') util.assert_validation_exception( self.manager.create_consumer_group, [error_codes.PLP1001], group_id, consumer_ids=['test_consumer', 'bad1']) group = self.collection.find_one({'id': group_id}) self.assertFalse(group is not None)
def test_invalid_repo_registry_id(self): config = PluginCallConfiguration({ constants.CONFIG_KEY_REPO_REGISTRY_ID: 'noUpperCase' }, {}) repo = Mock(id='repoid') assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config, repo) config2 = PluginCallConfiguration({ constants.CONFIG_KEY_REPO_REGISTRY_ID: 'Nouppsercase' }, {}) assert_validation_exception(configuration.validate_config, [error_codes.DKR1005], config2, repo)
def test_create_invalid_id(self): group_id = '**invalid/id**' util.assert_validation_exception(self.manager.create_consumer_group, [error_codes.PLP1003], group_id)
def test_server_url_missing_host_and_path(self): config = {constants.CONFIG_KEY_REDIRECT_URL: 'http://'} assert_validation_exception(configuration.validate_config, [error_codes.OST1002, error_codes.OST1003], config)
def test_create_duplicate_id(self): group_id = 'already_exists' self.manager.create_consumer_group(group_id) util.assert_validation_exception(self.manager.create_consumer_group, [error_codes.PLP1004], group_id)
def test_calls_method_with_child_exceptions(self): mock_method = Mock(side_effect=PulpCodedValidationException( validation_exceptions=[PulpCodedException()])) util.assert_validation_exception(mock_method, error_codes=[error_codes.PLP0001])
def test_init_invalid_checksum(self): path = os.path.join(self.metadata_file_dir, 'foo', 'header.xml') assert_validation_exception(MetadataFileContext, [PLP1005], path, checksum_type='invalid')
def test_calls_method_with_kwargs(self): mock_method = Mock(side_effect=PulpCodedValidationException()) util.assert_validation_exception(mock_method, [], baz="qux") mock_method.assert_called_once_with(baz="qux")
def test_create_missing_id(self): group_id = None util.assert_validation_exception(self.manager.create_consumer_group, [error_codes.PLP1002], group_id)
def test_configuration_protected_bad_str(self): config = PluginCallConfiguration( {constants.CONFIG_KEY_PROTECTED: 'apple'}, {}) assert_validation_exception(configuration.validate_config, [error_codes.OST1004], config)
def test_server_url_missing_scheme(self): config = {constants.CONFIG_KEY_REDIRECT_URL: 'www.pulpproject.org/foo'} assert_validation_exception(configuration.validate_config, [error_codes.OST1001, error_codes.OST1002], config)
def test_invalid_default_repo_registry_id(self): config = PluginCallConfiguration({}, {}) repo = Mock(id='InvalidRegistry') assert_validation_exception(configuration.validate_config, [error_codes.DKR1006], config, repo)
def test_configuration_protected_bad_str(self): config = PluginCallConfiguration({constants.CONFIG_KEY_PROTECTED: "apple"}, {}) assert_validation_exception(configuration.validate_config, [error_codes.OST1004], config)