# HG changeset patch # User Ralph Meijer # Date 1287255411 -7200 # Node ID a430976f2977e813a0fbd6c48524d73ea728194c # Parent e59b48f3f6369fa6db25be28ae724f246e880120 Make a copy of the config to prevent later modification. diff -r e59b48f3f636 -r a430976f2977 idavoll/memory_storage.py --- a/idavoll/memory_storage.py Sat Oct 16 20:54:52 2010 +0200 +++ b/idavoll/memory_storage.py Sat Oct 16 20:56:51 2010 +0200 @@ -100,7 +100,7 @@ self.nodeIdentifier = nodeIdentifier self._affiliations = {owner.userhost(): 'owner'} self._subscriptions = {} - self._config = config + self._config = copy.copy(config) def getType(self): diff -r e59b48f3f636 -r a430976f2977 idavoll/test/test_storage.py --- a/idavoll/test/test_storage.py Sat Oct 16 20:54:52 2010 +0200 +++ b/idavoll/test/test_storage.py Sat Oct 16 20:56:51 2010 +0200 @@ -101,6 +101,35 @@ return d + def test_createNodeChangingConfig(self): + """ + The configuration passed to createNode must be free to be changed. + """ + def cb(result): + node1, node2 = result + self.assertTrue(node1.getConfiguration()['pubsub#persist_items']) + + config = { + "pubsub#persist_items": True, + "pubsub#deliver_payloads": True, + "pubsub#send_last_published_item": 'on_sub', + "pubsub#node_type": 'leaf', + } + + def unsetPersistItems(_): + config["pubsub#persist_items"] = False + + d = defer.succeed(None) + d.addCallback(lambda _: self.s.createNode('new 1', OWNER, config)) + d.addCallback(unsetPersistItems) + d.addCallback(lambda _: self.s.createNode('new 2', OWNER, config)) + d.addCallback(lambda _: defer.gatherResults([ + self.s.getNode('new 1'), + self.s.getNode('new 2')])) + d.addCallback(cb) + return d + + def test_deleteNonExistingNode(self): d = self.s.deleteNode('non-existing') self.assertFailure(d, error.NodeNotFound)