mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Implement YamlProvider.supports that always says yes
This commit is contained in:
@@ -167,6 +167,14 @@ class YamlProvider(BaseProvider):
|
||||
del args['log']
|
||||
return self.__class__(**args)
|
||||
|
||||
def supports(self, record):
|
||||
# We're overriding this as a performance tweak, namely to avoid calling
|
||||
# the implementation of the SUPPORTS property to create a set from a
|
||||
# dict_keys every single time something checked whether we support a
|
||||
# record, the answer is always yes so that's overkill and we can just
|
||||
# return True here and be done with it
|
||||
return True
|
||||
|
||||
@property
|
||||
def SUPPORTS_ROOT_NS(self):
|
||||
return self.supports_root_ns
|
||||
|
||||
@@ -217,6 +217,20 @@ class TestYamlProvider(TestCase):
|
||||
str(ctx.exception),
|
||||
)
|
||||
|
||||
def test_supports_everything(self):
|
||||
source = YamlProvider('test', join(dirname(__file__), 'config'))
|
||||
|
||||
class DummyType(object):
|
||||
def __init__(self, _type):
|
||||
self._type = _type
|
||||
|
||||
# No matter what we check it's always supported
|
||||
self.assertTrue(source.supports(DummyType(None)))
|
||||
self.assertTrue(source.supports(DummyType(42)))
|
||||
self.assertTrue(source.supports(DummyType('A')))
|
||||
self.assertTrue(source.supports(DummyType(source)))
|
||||
self.assertTrue(source.supports(DummyType(self)))
|
||||
|
||||
|
||||
class TestSplitYamlProvider(TestCase):
|
||||
def test_list_all_yaml_files(self):
|
||||
|
||||
Reference in New Issue
Block a user