@@ -679,7 +679,7 @@ def test_diffcontent_show_unhandled_error(self, mock_execute):
679
679
self .tester .post (["diffcontent" ], body = body )
680
680
681
681
@patch ("jupyterlab_git.git.execute" )
682
- def test_diffcontent_getcontent_error (self , mock_execute ):
682
+ def test_diffcontent_getcontent_deleted_file (self , mock_execute ):
683
683
# Given
684
684
top_repo_path = "path/to/repo"
685
685
filename = "my/absent_file"
@@ -688,7 +688,6 @@ def test_diffcontent_getcontent_error(self, mock_execute):
688
688
mock_execute .side_effect = [
689
689
maybe_future ((0 , "1\t 1\t {}" .format (filename ), "" )),
690
690
maybe_future ((0 , content , "" )),
691
- maybe_future ((0 , content , "" )),
692
691
]
693
692
694
693
# When
@@ -699,5 +698,18 @@ def test_diffcontent_getcontent_error(self, mock_execute):
699
698
"top_repo_path" : top_repo_path ,
700
699
}
701
700
# Then
702
- with assert_http_error (404 , msg = "No such file or directory" ):
703
- self .tester .post (["diffcontent" ], body = body )
701
+ response = self .tester .post (["diffcontent" ], body = body )
702
+
703
+ # Then
704
+ assert response .status_code == 200
705
+ payload = response .json ()
706
+ assert payload ["prev_content" ] == content
707
+ assert payload ["curr_content" ] == ""
708
+ mock_execute .assert_has_calls (
709
+ [
710
+ call (
711
+ ["git" , "show" , "{}:{}" .format ("previous" , filename )],
712
+ cwd = os .path .join (self .notebook_dir , top_repo_path ),
713
+ )
714
+ ]
715
+ )
0 commit comments