From: Michal 'vorner' Vaner Date: Thu, 14 Mar 2013 10:01:38 +0000 (+0100) Subject: [2835] Test the uniqueness of names is enforced X-Git-Tag: bind10-1.1.0beta1-release~23^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97a7be5ddb8f5a89206912eae174bacf3d230a8e;p=thirdparty%2Fkea.git [2835] Test the uniqueness of names is enforced Which isn't at the moment, so it fails. --- diff --git a/src/bin/cfgmgr/plugins/tests/datasrc_test.py b/src/bin/cfgmgr/plugins/tests/datasrc_test.py index 83ec4ca84f..8de5f42eaa 100644 --- a/src/bin/cfgmgr/plugins/tests/datasrc_test.py +++ b/src/bin/cfgmgr/plugins/tests/datasrc_test.py @@ -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__': isc.log.init("bind10") isc.log.resetUnitTestRootLogger()