44
55import tornado
66
7+ from jupyterlab_git .git import Git
78from jupyterlab_git .handlers import (
89 GitAllHistoryHandler ,
910 GitBranchHandler ,
@@ -25,7 +26,7 @@ def test_mapping_added():
2526
2627
2728class TestAllHistory (ServerTest ):
28- @patch ("jupyterlab_git.handlers.GitAllHistoryHandler.git" )
29+ @patch ("jupyterlab_git.handlers.GitAllHistoryHandler.git" , spec = Git )
2930 def test_all_history_handler_localbranch (self , mock_git ):
3031 # Given
3132 show_top_level = {"code" : 0 , "foo" : "top_level" }
@@ -62,7 +63,7 @@ def test_all_history_handler_localbranch(self, mock_git):
6263
6364
6465class TestBranch (ServerTest ):
65- @patch ("jupyterlab_git.handlers.GitBranchHandler.git" )
66+ @patch ("jupyterlab_git.handlers.GitBranchHandler.git" , spec = Git )
6667 def test_branch_handler_localbranch (self , mock_git ):
6768 # Given
6869 branch = {
@@ -126,7 +127,7 @@ def test_branch_handler_localbranch(self, mock_git):
126127
127128
128129class TestLog (ServerTest ):
129- @patch ("jupyterlab_git.handlers.GitLogHandler.git" )
130+ @patch ("jupyterlab_git.handlers.GitLogHandler.git" , spec = Git )
130131 def test_log_handler (self , mock_git ):
131132 # Given
132133 log = {"code" : 0 , "commits" : []}
@@ -143,7 +144,7 @@ def test_log_handler(self, mock_git):
143144 payload = response .json ()
144145 assert payload == log
145146
146- @patch ("jupyterlab_git.handlers.GitLogHandler.git" )
147+ @patch ("jupyterlab_git.handlers.GitLogHandler.git" , spec = Git )
147148 def test_log_handler_no_history_count (self , mock_git ):
148149 # Given
149150 log = {"code" : 0 , "commits" : []}
@@ -162,7 +163,7 @@ def test_log_handler_no_history_count(self, mock_git):
162163
163164
164165class TestPush (ServerTest ):
165- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
166+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
166167 def test_push_handler_localbranch (self , mock_git ):
167168 # Given
168169 mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -184,7 +185,7 @@ def test_push_handler_localbranch(self, mock_git):
184185 payload = response .json ()
185186 assert payload == {"code" : 0 }
186187
187- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
188+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
188189 def test_push_handler_remotebranch (self , mock_git ):
189190 # Given
190191 mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -208,7 +209,7 @@ def test_push_handler_remotebranch(self, mock_git):
208209 payload = response .json ()
209210 assert payload == {"code" : 0 }
210211
211- @patch ("jupyterlab_git.handlers.GitPushHandler.git" )
212+ @patch ("jupyterlab_git.handlers.GitPushHandler.git" , spec = Git )
212213 def test_push_handler_noupstream (self , mock_git ):
213214 # Given
214215 mock_git .get_current_branch .return_value = maybe_future ("foo" )
@@ -233,7 +234,7 @@ def test_push_handler_noupstream(self, mock_git):
233234
234235
235236class TestUpstream (ServerTest ):
236- @patch ("jupyterlab_git.handlers.GitUpstreamHandler.git" )
237+ @patch ("jupyterlab_git.handlers.GitUpstreamHandler.git" , spec = Git )
237238 def test_upstream_handler_localbranch (self , mock_git ):
238239 # Given
239240 mock_git .get_current_branch .return_value = maybe_future ("foo" )
0 commit comments