Example #1
0
 def test_node_exists_nonexistant(self):
     """
     A node knows whether it exists or not.
     """
     node = ZNode("/zoo/rabbit", self.client)
     exists = yield node.exists()
     self.assertFalse(exists)
Example #2
0
 def test_node_set_data_update_with_cached_exists(self):
     """
     Data can be set on an existing node, updating it
     in place.
     """
     node = ZNode("/zoo/monkey", self.client)
     yield self.client.create("/zoo/monkey", "stripes")
     exists = yield node.exists()
     self.assertTrue(exists)
     yield node.set_data("banana")
     data, stat = yield self.client.get("/zoo/monkey")
     self.assertEqual(data, "banana")
Example #3
0
 def test_node_set_data_update_with_invalid_cached_exists(self):
     """
     If a node is deleted, attempting to set data on it
     raises a no node exception.
     """
     node = ZNode("/zoo/monkey", self.client)
     yield self.client.create("/zoo/monkey", "stripes")
     exists = yield node.exists()
     self.assertTrue(exists)
     yield self.client.delete("/zoo/monkey")
     d = node.set_data("banana")
     self.failUnlessFailure(d, zookeeper.NoNodeException)
     yield d