Skip to content

Commit 970d824

Browse files
committed
Fix history/current related tests
1 parent 421333d commit 970d824

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

gitfs/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
class Router(object):
3636
def __init__(self, remote_url, repo_path, mount_path,
37-
current_path, history_path, credentials,
37+
credentials, current_path="current", history_path="history",
3838
branch=None, user="root", group="root", **kwargs):
3939
"""
4040
Clone repo from a remote into repo_path/<repo_name> and checkout to

gitfs/views/current.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, *args, **kwargs):
3434
super(CurrentView, self).__init__(*args, **kwargs)
3535
self.dirty = {}
3636

37-
self.current_path = kwargs['current_path']
37+
self.current_path = kwargs.get('current_path', 'current')
3838

3939
@write_operation
4040
@not_in("ignore", check=["old", "new"])

gitfs/views/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class IndexView(ReadOnlyView):
2626
def __init__(self, *args, **kwargs):
2727
super(ReadOnlyView, self).__init__(*args, **kwargs)
2828

29-
self.current_path = kwargs['current_path']
30-
self.history_path = kwargs['history_path']
29+
self.current_path = kwargs.get('current_path', 'current')
30+
self.history_path = kwargs.get('history_path', 'history')
3131

3232
def getattr(self, path, fh=None):
3333
'''

gitfs/views/passthrough.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def __init__(self, *args, **kwargs):
3333
self.repo = kwargs['repo']
3434
self.root = kwargs['repo_path']
3535

36-
self.is_current_path_root = ('/' == kwargs['current_path'])
37-
self.history_path = kwargs['history_path']
36+
self.is_current_path_root = kwargs.get('current_path', 'current') == '/'
37+
self.history_path = kwargs.get('history_path', 'history')
3838

3939
def access(self, path, mode):
4040
full_path = self.repo._full_path(path)

tests/test_mount.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def test_prepare_components(self):
4545
'remote_url': 'remote_url',
4646
'mount_point': 'mount_point',
4747
'username': 'user',
48+
'current_path': 'current',
49+
'history_path': 'history',
4850
'password': '',
4951
'ssh_key': '/home/user/.ssh/id_rsa',
5052
'ssh_user': 'user',
@@ -80,7 +82,7 @@ def test_prepare_components(self):
8082
with patch.multiple('gitfs.mounter',
8183
CommitQueue=MagicMock(return_value=mocked_queue),
8284
Router=MagicMock(return_value=mocked_router),
83-
routes=mocked_routes, SyncWorker=mocked_merger,
85+
prepare_routes=mocked_routes, SyncWorker=mocked_merger,
8486
FetchWorker=mocked_fetcher, FUSE=mocked_fuse,
8587
get_credentials=MagicMock(return_value='cred')):
8688

tests/test_router.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def test_get_view(self):
200200
'ignore': mocks['repo'].ignore,
201201
'repo_path': mocks['repo_path'],
202202
'mount_path': mocks['mount_path'],
203+
'history_path': 'history',
204+
'current_path': 'current',
203205
'regex': "/current",
204206
'relative_path': "/",
205207
'uid': 1,

0 commit comments

Comments
 (0)