-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Disable cycling while editing a PM #1280
base: main
Are you sure you want to change the base?
Changes from 1 commit
b45eb77
7cfffe0
cdb0fad
415f31f
2a66b5d
691296d
f1590cb
ba32129
40e6067
ac20ad7
2bd5228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1731,6 +1731,37 @@ def test__setup_common_private_compose(self, mocker: MockerFixture) -> None: | |
) | ||
assert write_box.focus_position == 1 | ||
|
||
@pytest.mark.parametrize( | ||
"recipient_user_ids, expected_recipient_emails, expected_recipient_info", | ||
[ | ||
( | ||
[11, 12], | ||
["person1@example.com", "person2@example.com"], | ||
"Human 1 <person1@example.com>, Human 2 <person2@example.com>", | ||
), | ||
([11], ["person1@example.com"], "Human 1 <person1@example.com>"), | ||
([], [], ""), | ||
], | ||
) | ||
def test_update_recipients_from_user_ids( | ||
self, | ||
recipient_user_ids: List[int], | ||
expected_recipient_emails: List[str], | ||
expected_recipient_info: str, | ||
user_dict: List[Dict[str, Any]], | ||
user_id_email_dict: Dict[int, str], | ||
) -> None: | ||
write_box = WriteBox(self.view) | ||
write_box.model.user_id_email_dict = user_id_email_dict | ||
write_box.model.user_dict = user_dict | ||
|
||
write_box.recipient_info = write_box.update_recipients_from_user_ids( | ||
recipient_user_ids | ||
) | ||
|
||
assert write_box.recipient_emails == expected_recipient_emails | ||
assert write_box.recipient_info == expected_recipient_info | ||
Comment on lines
+1822
to
+1827
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this isn't too likely to break anything, the assignment to write_box.recipient_info is related to the current implementation of the function that uses this new function (currently private_box_view, if we make that change in the earlier commit). This test should only care about what the function should achieve internally, including what it returns. The return value can be set to a local name in this test function - it doesn't need to be This can be one of the challenges of writing tests for helper functions. |
||
|
||
@pytest.mark.parametrize("key", keys_for_command("MARKDOWN_HELP")) | ||
def test_keypress_MARKDOWN_HELP( | ||
self, write_box: WriteBox, key: str, widget_size: Callable[[Widget], urwid_Size] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're testing these elements, it could be useful to include how the other internal function is called for completeness (
_set_regular_and_typing_recipient_user_ids
).