Fix broken test.

This commit is contained in:
Dan Helfman
2026-05-29 11:57:13 -07:00
parent a876ce2058
commit 5a74b3d081
3 changed files with 16 additions and 4 deletions
+7 -1
View File
@@ -51,7 +51,9 @@ def make_directory_list_option(archive_path, relative_path_components):
relative_path_components[0],
) + (('', archive_path.link_target) if archive_path.link_target else ())
return textual.widgets.option_list.Option(prompt=' '.join(pieces), id=relative_path_components[0])
return textual.widgets.option_list.Option(
prompt=' '.join(pieces), id=relative_path_components[0]
)
def add_archive_paths(
@@ -61,6 +63,10 @@ def add_archive_paths(
archive_name,
archive_paths,
):
'''
Given a DirectoryList instance, a configuration dict, a repository dict, an archive name, and a
sequence of ArchivePath instances, add the archive paths to the directory list as options.
'''
highlighted_option = directory_list.highlighted_option
original_options_count = len(directory_list.options)
@@ -7,8 +7,10 @@ import textual.widgets.option_list
def test_file_preview_does_not_raise():
flexmock(module.borgmatic.actions.browse.loading).should_receive('add_inline_loading_indicator')
flexmock(module.borgmatic.actions.browse.workers).should_receive('load_file_preview')
flexmock(module.borgmatic.actions.browse.repositories_list.Repositories_list).should_receive(
flexmock(module.borgmatic.actions.browse.file_preview.File_preview).should_receive(
'app'
).and_return(flexmock())
module.Repositories_list(config=flexmock())
module.File_preview(
config=flexmock(), repository=flexmock(), archive_name='archive', file_path='foo/bar.txt'
)
@@ -50,7 +50,11 @@ def test_make_directory_list_option_with_contained_file_path_makes_directory_opt
flexmock(module.textual.widgets.option_list).should_receive('Option').replace_with(flexmock)
option = module.make_directory_list_option(
flexmock(path_type='d', file_path='foo/bar/baz.txt', link_target=''), ('bar', 'baz.txt',)
flexmock(path_type='d', file_path='foo/bar/baz.txt', link_target=''),
(
'bar',
'baz.txt',
),
)
assert option.prompt == '📁 bar'