Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
    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))
Ejemplo n.º 7
0
    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)
Ejemplo n.º 8
0
    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)