|
@@ -153,6 +153,82 @@ class DatasrcTest(unittest.TestCase):
|
|
}
|
|
}
|
|
}]})
|
|
}]})
|
|
|
|
|
|
|
|
+ def test_names_present(self):
|
|
|
|
+ """
|
|
|
|
+ Test we don't choke on configuration with the "name" being present on
|
|
|
|
+ some items.
|
|
|
|
+ """
|
|
|
|
+ self.accept({"IN": [{
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {},
|
|
|
|
+ "name": "Whatever"
|
|
|
|
+ }]})
|
|
|
|
+
|
|
|
|
+ def test_names_default_classes(self):
|
|
|
|
+ """
|
|
|
|
+ Test we can have a client of the same type in different classes
|
|
|
|
+ without specified name. The defaults should be derived both from
|
|
|
|
+ the type and the class.
|
|
|
|
+ """
|
|
|
|
+ self.accept({
|
|
|
|
+ "IN": [{
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {}
|
|
|
|
+ }],
|
|
|
|
+ "CH": [{
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {}
|
|
|
|
+ }]})
|
|
|
|
+
|
|
|
|
+ def test_names_collision(self):
|
|
|
|
+ """
|
|
|
|
+ Reject when two names are the same.
|
|
|
|
+
|
|
|
|
+ Cases are:
|
|
|
|
+ - Explicit names.
|
|
|
|
+ - Two default names turn out to be the same (same type and class).
|
|
|
|
+ - One explicit is set to the same as the default one.
|
|
|
|
+ """
|
|
|
|
+ self.reject({"IN": [
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {},
|
|
|
|
+ "name": "Whatever"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {},
|
|
|
|
+ "name": "Whatever"
|
|
|
|
+ }]})
|
|
|
|
+ self.reject({"IN": [
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {}
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {}
|
|
|
|
+ }]})
|
|
|
|
+ self.reject({"IN": [
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {},
|
|
|
|
+ "name": "IN/MasterFiles"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "type": "MasterFiles",
|
|
|
|
+ "cache-enable": True,
|
|
|
|
+ "params": {}
|
|
|
|
+ }]})
|
|
|
|
+
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
isc.log.init("bind10")
|
|
isc.log.init("bind10")
|
|
isc.log.resetUnitTestRootLogger()
|
|
isc.log.resetUnitTestRootLogger()
|