comparison 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
comparison
equal deleted inserted replaced
220:e59b48f3f636 221:a430976f2977
95 return d 95 return d
96 96
97 config = self.s.getDefaultConfiguration('leaf') 97 config = self.s.getDefaultConfiguration('leaf')
98 config['pubsub#node_type'] = 'leaf' 98 config['pubsub#node_type'] = 'leaf'
99 d = self.s.createNode('new 1', OWNER, config) 99 d = self.s.createNode('new 1', OWNER, config)
100 d.addCallback(cb)
101 return d
102
103
104 def test_createNodeChangingConfig(self):
105 """
106 The configuration passed to createNode must be free to be changed.
107 """
108 def cb(result):
109 node1, node2 = result
110 self.assertTrue(node1.getConfiguration()['pubsub#persist_items'])
111
112 config = {
113 "pubsub#persist_items": True,
114 "pubsub#deliver_payloads": True,
115 "pubsub#send_last_published_item": 'on_sub',
116 "pubsub#node_type": 'leaf',
117 }
118
119 def unsetPersistItems(_):
120 config["pubsub#persist_items"] = False
121
122 d = defer.succeed(None)
123 d.addCallback(lambda _: self.s.createNode('new 1', OWNER, config))
124 d.addCallback(unsetPersistItems)
125 d.addCallback(lambda _: self.s.createNode('new 2', OWNER, config))
126 d.addCallback(lambda _: defer.gatherResults([
127 self.s.getNode('new 1'),
128 self.s.getNode('new 2')]))
100 d.addCallback(cb) 129 d.addCallback(cb)
101 return d 130 return d
102 131
103 132
104 def test_deleteNonExistingNode(self): 133 def test_deleteNonExistingNode(self):