config: Remove ExtensionConfigSchema
This commit is contained in:
parent
b7232797ea
commit
2f8bc32c14
@ -98,18 +98,6 @@ class ConfigSchema(object):
|
||||
return result
|
||||
|
||||
|
||||
class ExtensionConfigSchema(ConfigSchema):
|
||||
"""Sub-classed :class:`ConfigSchema` for use in extensions.
|
||||
|
||||
Ensures that ``enabled`` config value is present.
|
||||
"""
|
||||
def __init__(self, name):
|
||||
super(ExtensionConfigSchema, self).__init__(name)
|
||||
self['enabled'] = types.Boolean()
|
||||
|
||||
# TODO: override serialize to gate on enabled=true?
|
||||
|
||||
|
||||
class LogLevelConfigSchema(object):
|
||||
"""Special cased schema for handling a config section with loglevels.
|
||||
|
||||
|
||||
@ -46,7 +46,9 @@ class Extension(object):
|
||||
|
||||
:returns: :class:`~mopidy.config.schema.ExtensionConfigSchema`
|
||||
"""
|
||||
return config_lib.ExtensionConfigSchema(self.ext_name)
|
||||
schema = config_lib.ConfigSchema(self.ext_name)
|
||||
schema['enabled'] = config_lib.Boolean()
|
||||
return schema
|
||||
|
||||
def validate_environment(self):
|
||||
"""Checks if the extension can run in the current environment
|
||||
|
||||
@ -77,12 +77,6 @@ class ConfigSchemaTest(unittest.TestCase):
|
||||
self.assertIsNone(result['baz'])
|
||||
|
||||
|
||||
class ExtensionConfigSchemaTest(unittest.TestCase):
|
||||
def test_schema_includes_enabled(self):
|
||||
schema = schemas.ExtensionConfigSchema('test')
|
||||
self.assertIsInstance(schema['enabled'], types.Boolean)
|
||||
|
||||
|
||||
class LogLevelConfigSchemaTest(unittest.TestCase):
|
||||
def test_conversion(self):
|
||||
schema = schemas.LogLevelConfigSchema('test')
|
||||
|
||||
@ -23,7 +23,6 @@ class ExtensionTest(unittest.TestCase):
|
||||
|
||||
def test_get_config_schema_returns_extension_schema(self):
|
||||
schema = self.ext.get_config_schema()
|
||||
self.assertIsInstance(schema, config.ExtensionConfigSchema)
|
||||
self.assertIsInstance(schema['enabled'], config.Boolean)
|
||||
|
||||
def test_validate_environment_does_nothing_by_default(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user