Exemplo n.º 1
0
    def setUp(self):
        super().setUp()
        stack = contextlib.ExitStack()
        self.addCleanup(stack.close)

        self._client = stack.enter_context(
            client.CreateFilesystemClient(self._server.Connect(),
                                          filesystem_pb2.NTFS,
                                          client.FileDevice(self._ntfs_image)))
Exemplo n.º 2
0
    def setUp(self):
        super(NtfsTest, self).setUp()
        stack = contextlib.ExitStack()
        self.addCleanup(stack.close)

        ntfs_image = stack.enter_context(
            open(os.path.join(config.CONFIG["Test.data_dir"], "ntfs.img"),
                 "rb"))
        self._client = stack.enter_context(
            client.CreateFilesystemClient(self._server.Connect(),
                                          filesystem_pb2.NTFS,
                                          client.FileDevice(ntfs_image)))
Exemplo n.º 3
0
  def setUpClass(cls):
    super().setUpClass()
    cls._exit_stack = contextlib.ExitStack()

    ntfs_image = cls._exit_stack.enter_context(
        open(os.path.join(config.CONFIG["Test.data_dir"], "ntfs.img"), "rb"))
    cls._server = server.CreateFilesystemServer(ntfs_image.fileno())
    cls._server.Start()

    cls._client = cls._exit_stack.enter_context(
        client.CreateFilesystemClient(cls._server.Connect(),
                                      cls._IMPLEMENTATION_TYPE,
                                      client.FileDevice(ntfs_image)))
Exemplo n.º 4
0
    def setUp(self):
        super().setUp()
        stack = contextlib.ExitStack()
        self.addCleanup(stack.close)

        ntfs_image = stack.enter_context(
            open(os.path.join(config.CONFIG["Test.data_dir"], "ntfs.img"),
                 "rb"))

        # The FileDevice won't return a file descriptor.
        stack.enter_context(
            mock.patch.object(client.FileDevice, "file_descriptor", None))

        self._client = stack.enter_context(
            client.CreateFilesystemClient(self._server.Connect(),
                                          filesystem_pb2.NTFS,
                                          client.FileDevice(ntfs_image)))