def test_attach_file_raises_error(capsys): with temp_directory(): _attach_file('tempfile.txt', 'fake_gist_slug', version=2) expected_result = "[jovian] Error: [Errno 2] No such file or directory: 'tempfile.txt' (tempfile.txt)" captured = capsys.readouterr() assert captured.err.strip() == expected_result
def test_attach_file(mock_upload_file): with temp_directory(): os.system('touch tempfile.txt') _attach_file('tempfile.txt', 'fake_gist_slug', version=2) mock_upload_file.assert_called_with('fake_gist_slug', ('tempfile.txt', ANY), ANY, 2, False)