Ejemplo n.º 1
0
    async def testStreamCreateErrors(self):
        # name conflict
        stream = api.DataStream(name="s1a1", elements=[api.Element(name="e1")])
        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_create(stream, "/test/f1/f1a")

        # missing elements
        stream = api.DataStream(name="no elements", elements=[])
        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_create(stream, "/test/f1/f1a")

        # invalid values
        stream = api.DataStream(name="invalid datatype",
                                datatype="invalid",
                                elements=[api.Element(name="e1")])
        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_create(stream, "/test/f1/f1a")
Ejemplo n.º 2
0
 async def test_folder_move_errors(self):
     # source does not exist
     with self.assertRaises(errors.ApiError):
         await self.node.folder_move("/test/f1/bad", "/test/f2")
     # circular graph
     with self.assertRaises(errors.ApiError):
         await self.node.folder_move("/test/f1", "/test/f1/f1a")
     # name conflict
     stream = api.DataStream(name="s1a1", elements=[api.Element(name="e1")])
     await self.node.data_stream_create(stream, "/test/f1/f2")
     with self.assertRaises(errors.ApiError):
         await self.node.folder_move("/test/f1/f2", "/test")
     # locked folder
     with self.assertRaises(errors.ApiError):
         await self.node.folder_move("/live/base", "/test")
Ejemplo n.º 3
0
    async def test_move_errors(self):
        # stream does not exist
        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_move("/test/f1/f1a/bad",
                                             "/test/f2/new")

        # name conflict
        stream = api.DataStream(name="s1a1", elements=[api.Element(name="e1")])
        await self.node.data_stream_create(stream, "/test/f2")

        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_move(stream, "/test/f1/f1a")

        # locked stream
        with self.assertRaises(errors.ApiError):
            await self.node.data_stream_move("/live/base", "/test/f2/new")
Ejemplo n.º 4
0
 async def setUp(self):
     self.node = api.get_node()
     """
     └── test
         ├── f1
         │   ├── f1a
         │   │   ├── s1a1
         │   │   └── s1a2
         │   └── s1a
         └── f2
             └── f2a
                 └── s2a1a
     """
     stream = api.DataStream(name="s1a1", elements=[api.Element(name="e1")])
     await self.node.data_stream_create(stream, "/test/f1/f1a")
     stream.name = "s1a2"
     await self.node.data_stream_create(stream, "/test/f1/f1a")
     stream.name = "s1a"
     await self.node.data_stream_create(stream, "/test/f1")
     stream.name = "s2a1a"
     await self.node.data_stream_create(stream, "/test/f2/f2a")