Skip to content

Commit b2ba590

Browse files
test_boxes: test for append_uri_and_filename.
Test cases of diffrent file formats.Firstly a initial edit text is set which is appended by calling append_uri_and_filename.
1 parent 2d76e2b commit b2ba590

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/ui_tools/test_boxes.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,35 @@ def test_keypress_typeahead_mode_autocomplete_key(
15261526
else:
15271527
self.view.set_footer_text.assert_not_called()
15281528

1529+
@pytest.mark.parametrize(
1530+
"file_name, uri, expected_result",
1531+
[
1532+
case(
1533+
"example.txt",
1534+
"http://example.com/example.txt",
1535+
"Initial content[example.txt](http://example.com/example.txt)",
1536+
id="txt_file",
1537+
),
1538+
case(
1539+
"file.pdf",
1540+
"http://example.com/file.pdf",
1541+
"Initial content[file.pdf](http://example.com/file.pdf)",
1542+
id="pdf_file",
1543+
),
1544+
],
1545+
)
1546+
def test_append_uri_and_filename(
1547+
self, write_box: WriteBox, file_name: str, uri: str, expected_result: str
1548+
) -> None:
1549+
initial_edit_text = "Initial content"
1550+
write_box.private_box_view(recipient_user_ids=[])
1551+
write_box.msg_write_box.edit_text = initial_edit_text
1552+
1553+
write_box.append_uri_and_filename(file_name, uri)
1554+
result_edit_text = write_box.msg_write_box.edit_text
1555+
1556+
assert result_edit_text == expected_result
1557+
15291558
@pytest.mark.parametrize(
15301559
[
15311560
"initial_focus_name",

0 commit comments

Comments
 (0)