示例#1
0
    def test_current_data_matches_new_data(self):
        data = b"data"
        self.zookeeper.set(TEST_NODE_PATH, data)

        input = BytesIO(data)
        did_write = write_file_to_zookeeper(self.zookeeper, input,
                                            TEST_NODE_PATH)
        self.assertFalse(did_write)
示例#2
0
    def test_successful_set(self):
        self.assertEqual(self.zookeeper.get(TEST_NODE_PATH)[0], b"")

        input = BytesIO(b"new_data")
        did_write = write_file_to_zookeeper(self.zookeeper, input,
                                            TEST_NODE_PATH)
        self.assertTrue(did_write)

        self.assertEqual(self.zookeeper.get(TEST_NODE_PATH)[0], b"new_data")
示例#3
0
 def test_compress(self):
     raw = b"test"
     compressed = publisher.gzip_compress(raw)
     decompressed = gzip.GzipFile(fileobj=BytesIO(compressed)).read()
     self.assertEqual(raw, decompressed)
示例#4
0
    def test_exits_when_node_does_not_exist(self):
        input = BytesIO()

        with self.assertRaises(NodeDoesNotExistError):
            write_file_to_zookeeper(self.zookeeper, input, "/does_not_exist")