Mercurial > libervia-pubsub
diff idavoll/test/test_storage.py @ 221:a430976f2977
Make a copy of the config to prevent later modification.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Sat, 16 Oct 2010 20:56:51 +0200 |
parents | bb7103da9879 |
children | 0eafdced5f24 |
line wrap: on
line diff
--- 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)