Exemplo n.º 1
0
    def test_read(self):
        mocked_read = MagicMock()
        mocked_lseek = MagicMock()
        mocked_read.return_value = "magic"

        with patch('gitfs.views.passthrough.os.read', mocked_read):
            with patch('gitfs.views.passthrough.os.lseek', mocked_lseek):
                view = PassthroughView(repo=self.repo, repo_path=self.repo_path)
                result = view.read("/magic/path", 10, 10, 0)

                assert result == "magic"
                mocked_read.assert_called_once_with(0, 10)
                mocked_lseek.assert_called_once_with(0, 10, os.SEEK_SET)
Exemplo n.º 2
0
    def test_read(self):
        mocked_read = MagicMock()
        mocked_lseek = MagicMock()
        mocked_read.return_value = "magic"

        with patch('gitfs.views.passthrough.os.read', mocked_read):
            with patch('gitfs.views.passthrough.os.lseek', mocked_lseek):
                view = PassthroughView(repo=self.repo,
                                       repo_path=self.repo_path)
                result = view.read("/magic/path", 10, 10, 0)

                assert result == "magic"
                mocked_read.assert_called_once_with(0, 10)
                mocked_lseek.assert_called_once_with(0, 10, os.SEEK_SET)