Exemple #1
0
    def test_start_fuse(self):
        mocked_parse_args = MagicMock()
        mocked_prepare = MagicMock()
        mocked_argp = MagicMock()
        mocked_fuse = MagicMock()
        mocked_resource = MagicMock()
        mocked_args = MagicMock()

        mocked_merge = MagicMock()
        mocked_fetch = MagicMock()
        mocked_router = MagicMock()

        mocked_prepare.return_value = (mocked_merge, mocked_fetch,
                                       mocked_router)
        mocked_argp.ArgumentParser.return_value = "args"
        mocked_parse_args.return_value = mocked_args

        with patch.multiple(
                "gitfs.mounter",
                argparse=mocked_argp,
                parse_args=mocked_parse_args,
                prepare_components=mocked_prepare,
                FUSE=mocked_fuse,
                resource=MagicMock(),
        ):
            start_fuse()

            mocked_argp.ArgumentParser.assert_called_once_with(prog="GitFS")
            mocked_parse_args.assert_called_once_with("args")
            mocked_prepare.assert_called_once_with(mocked_args)

            excepted_call = {
                "foreground": mocked_args.foreground,
                "allow_root": mocked_args.allow_root,
                "allow_other": mocked_args.allow_other,
                "subtype": "gitfs",
                "fsname": mocked_args.remote_url,
            }

            if sys.platform != "darwin":
                excepted_call["nonempty"] = True

            mocked_fuse.assert_called_once_with(mocked_router,
                                                mocked_args.mount_point,
                                                **excepted_call)
Exemple #2
0
    def test_start_fuse(self):
        mocked_parse_args = MagicMock()
        mocked_prepare = MagicMock()
        mocked_argp = MagicMock()
        mocked_fuse = MagicMock()
        mocked_resource = MagicMock()
        mocked_args = MagicMock()

        mocked_merge = MagicMock()
        mocked_fetch = MagicMock()
        mocked_router = MagicMock()

        mocked_prepare.return_value = (mocked_merge, mocked_fetch,
                                       mocked_router)
        mocked_argp.ArgumentParser.return_value = "args"
        mocked_parse_args.return_value = mocked_args

        with patch.multiple('gitfs.mounter',
                            argparse=mocked_argp,
                            parse_args=mocked_parse_args,
                            prepare_components=mocked_prepare,
                            FUSE=mocked_fuse,
                            resource=MagicMock()):
            start_fuse()

            mocked_argp.ArgumentParser.assert_called_once_with(prog='GitFS')
            mocked_parse_args.assert_called_once_with("args")
            mocked_prepare.assert_called_once_with(mocked_args)

            excepted_call = {
                'foreground': mocked_args.foreground,
                'allow_root': mocked_args.allow_root,
                'allow_other': mocked_args.allow_other,
                'subtype': 'gitfs',
                'fsname': mocked_args.remote_url
            }

            if sys.platform != 'darwin':
                excepted_call['nonempty'] = True

            mocked_fuse.assert_called_once_with(mocked_router,
                                                mocked_args.mount_point,
                                                **excepted_call)
Exemple #3
0
    def test_start_fuse(self):
        mocked_parse_args = MagicMock()
        mocked_prepare = MagicMock()
        mocked_argp = MagicMock()
        mocked_fuse = MagicMock()
        mocked_resource = MagicMock()
        mocked_args = MagicMock()

        mocked_merge = MagicMock()
        mocked_fetch = MagicMock()
        mocked_router = MagicMock()

        mocked_prepare.return_value = (mocked_merge, mocked_fetch,
                                       mocked_router)
        mocked_argp.ArgumentParser.return_value = "args"
        mocked_parse_args.return_value = mocked_args

        with patch.multiple('gitfs.mounter', argparse=mocked_argp,
                            parse_args=mocked_parse_args,
                            prepare_components=mocked_prepare,
                            FUSE=mocked_fuse, resource=MagicMock()):
            start_fuse()

            mocked_argp.ArgumentParser.assert_called_once_with(prog='GitFS')
            mocked_parse_args.assert_called_once_with("args")
            mocked_prepare.assert_called_once_with(mocked_args)

            excepted_call = {
                'foreground': mocked_args.foreground,
                'allow_root': mocked_args.allow_root,
                'allow_other': mocked_args.allow_other,
                'subtype': 'gitfs',
                'fsname': mocked_args.remote_url
            }

            if sys.platform != 'darwin':
                excepted_call['nonempty'] = True

            mocked_fuse.assert_called_once_with(mocked_router,
                                                mocked_args.mount_point,
                                                **excepted_call)
Exemple #4
0
def mount():
    from gitfs.mounter import start_fuse
    start_fuse()