4
4
5
5
import tornado
6
6
7
+ from jupyterlab_git .git import Git
7
8
from jupyterlab_git .handlers import (
8
9
GitAllHistoryHandler ,
9
10
GitBranchHandler ,
@@ -25,7 +26,7 @@ def test_mapping_added():
25
26
26
27
27
28
class TestAllHistory (ServerTest ):
28
- @patch ("jupyterlab_git.handlers.GitAllHistoryHandler.git" )
29
+ @patch ("jupyterlab_git.handlers.GitAllHistoryHandler.git" , spec = Git )
29
30
def test_all_history_handler_localbranch (self , mock_git ):
30
31
# Given
31
32
show_top_level = {"code" : 0 , "foo" : "top_level" }
@@ -62,7 +63,7 @@ def test_all_history_handler_localbranch(self, mock_git):
62
63
63
64
64
65
class TestBranch (ServerTest ):
65
- @patch ("jupyterlab_git.handlers.GitBranchHandler.git" )
66
+ @patch ("jupyterlab_git.handlers.GitBranchHandler.git" , spec = Git )
66
67
def test_branch_handler_localbranch (self , mock_git ):
67
68
# Given
68
69
branch = {
@@ -126,7 +127,7 @@ def test_branch_handler_localbranch(self, mock_git):
126
127
127
128
128
129
class TestLog (ServerTest ):
129
- @patch ("jupyterlab_git.handlers.GitLogHandler.git" )
130
+ @patch ("jupyterlab_git.handlers.GitLogHandler.git" , spec = Git )
130
131
def test_log_handler (self , mock_git ):
131
132
# Given
132
133
log = {"code" : 0 , "commits" : []}
@@ -143,7 +144,7 @@ def test_log_handler(self, mock_git):
143
144
payload = response .json ()
144
145
assert payload == log
145
146
146
- @patch ("jupyterlab_git.handlers.GitLogHandler.git" )
147
+ @patch ("jupyterlab_git.handlers.GitLogHandler.git" , spec = Git )
147
148
def test_log_handler_no_history_count (self , mock_git ):
148
149
# Given
149
150
log = {"code" : 0 , "commits" : []}
@@ -162,7 +163,7 @@ def test_log_handler_no_history_count(self, mock_git):
162
163
163
164
164
165
class TestPush (ServerTest ):
165
- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
166
+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
166
167
def test_push_handler_localbranch (self , mock_git ):
167
168
# Given
168
169
mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -184,7 +185,7 @@ def test_push_handler_localbranch(self, mock_git):
184
185
payload = response .json ()
185
186
assert payload == {"code" : 0 }
186
187
187
- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
188
+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
188
189
def test_push_handler_remotebranch (self , mock_git ):
189
190
# Given
190
191
mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -208,7 +209,7 @@ def test_push_handler_remotebranch(self, mock_git):
208
209
payload = response .json ()
209
210
assert payload == {"code" : 0 }
210
211
211
- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
212
+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
212
213
def test_push_handler_noupstream (self , mock_git ):
213
214
# Given
214
215
mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -233,7 +234,7 @@ def test_push_handler_noupstream(self, mock_git):
233
234
234
235
235
236
class TestUpstream (ServerTest ):
236
- @patch ("jupyterlab_git.handlers.GitUpstreamHandler.git" )
237
+ @patch ("jupyterlab_git.handlers.GitUpstreamHandler.git" , spec = Git )
237
238
def test_upstream_handler_localbranch (self , mock_git ):
238
239
# Given
239
240
mock_git .get_current_branch .return_value = maybe_future ("foo" )
0 commit comments