1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Rework _AggregateTarget to dynamically handle SUPPORTS

This commit is contained in:
Ross McFarland
2022-02-08 09:31:42 -08:00
parent 9441a51168
commit e0a5f4d746
4 changed files with 32 additions and 13 deletions

View File

@@ -235,6 +235,20 @@ class TestManager(TestCase):
dynamic = DynamicProvider()
nosshfp = NoSshFpProvider()
targets = [simple, geo]
at = _AggregateTarget(targets)
# expected targets
self.assertEqual(targets, at.targets)
# union of their SUPPORTS
self.assertEqual(set(('A')), at.SUPPORTS)
# unknown property will go up into super and throw the normal
# exception
with self.assertRaises(AttributeError) as ctx:
at.FOO
self.assertEqual('_AggregateTarget object has no attribute FOO',
str(ctx.exception))
self.assertFalse(_AggregateTarget([simple, simple]).SUPPORTS_GEO)
self.assertFalse(_AggregateTarget([simple, geo]).SUPPORTS_GEO)
self.assertFalse(_AggregateTarget([geo, simple]).SUPPORTS_GEO)