Exemplo n.º 1
0
    def test_access(self):
        mocked_access = MagicMock()
        mocked_access.side_effect = [True, True, False]

        with patch('gitfs.views.passthrough.os.access', mocked_access):
            view = PassthroughView(repo=self.repo, repo_path=self.repo_path)

            # normal, easy test
            view.access('good/relative/path', 777)
            # test if _full_path works
            view.access('/good/relative/path', 777)
            # test if proper exception is raised
            with raises(FuseOSError):
                view.access('/relative/path', 777)

            asserted_calls = [call('/the/root/path/good/relative/path', 777),
                              call('/the/root/path/good/relative/path', 777),
                              call('/the/root/path/relative/path', 777)]
            mocked_access.assert_has_calls(asserted_calls)
            assert mocked_access.call_count == 3
Exemplo n.º 2
0
    def test_access(self):
        mocked_access = MagicMock()
        mocked_access.side_effect = [True, True, False]

        with patch('gitfs.views.passthrough.os.access', mocked_access):
            view = PassthroughView(repo=self.repo, repo_path=self.repo_path)

            # normal, easy test
            view.access('good/relative/path', 777)
            # test if _full_path works
            view.access('/good/relative/path', 777)
            # test if proper exception is raised
            with raises(FuseOSError):
                view.access('/relative/path', 777)

            asserted_calls = [
                call('/the/root/path/good/relative/path', 777),
                call('/the/root/path/good/relative/path', 777),
                call('/the/root/path/relative/path', 777)
            ]
            mocked_access.assert_has_calls(asserted_calls)
            assert mocked_access.call_count == 3