def test_validate_extensions(self): global_exts = 'volume_manager', 'bareon', 'ultralogger' with mock.patch( 'nailgun.api.v1.validators.extension.get_all_extensions', return_value=make_mock_extensions(global_exts)): ExtensionValidator.validate(jsonutils.dumps(global_exts))
def test_invalid_delete_extensions(self): global_exts = 'volume_manager', 'bareon', 'ultralogger' data = 'volume_manager', 'bareon', 'invalid' cluster = mock.Mock() cluster.extensions = global_exts with self.assertRaisesRegexp(errors.CannotFindExtension, 'No such extensions to disable: invalid'): ExtensionValidator.validate_delete(set(data), cluster)
def test_invalid_extension(self): global_exts = 'volume_manager', 'bareon', 'ultralogger' data = 'volume_manager', 'baleron' with mock.patch( 'nailgun.api.v1.validators.extension.get_all_extensions', return_value=make_mock_extensions(global_exts)): with self.assertRaisesRegexp(errors.CannotFindExtension, 'No such extensions: baleron'): ExtensionValidator.validate(jsonutils.dumps(data))
def test_validate_delete_extensions(self): global_exts = 'volume_manager', 'bareon', 'ultralogger' cluster = mock.Mock() cluster.extensions = global_exts ExtensionValidator.validate_delete(set(global_exts[:2]), cluster)