-
-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils/messages: Add a dummy message for empty narrows.
Tests updated. Co-authored-by: Sumanth V Rao <[email protected]>
- Loading branch information
1 parent
299a1c1
commit 3444552
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ def test_init(self, mocker, message_type, set_fields): | |
display_recipient=[ | ||
{"id": 7, "email": "[email protected]", "full_name": "Boo is awesome"} | ||
], | ||
id=457823, | ||
stream_id=5, | ||
subject="hi", | ||
sender_email="[email protected]", | ||
|
@@ -71,6 +72,7 @@ def test_private_message_to_self(self, mocker): | |
display_recipient=[ | ||
{"full_name": "Foo Foo", "email": "[email protected]", "id": None} | ||
], | ||
id=457823, | ||
sender_id=9, | ||
content="<p> self message. </p>", | ||
sender_full_name="Foo Foo", | ||
|
@@ -82,6 +84,7 @@ def test_private_message_to_self(self, mocker): | |
MODULE + ".MessageBox._is_private_message_to_self", return_value=True | ||
) | ||
mocker.patch.object(MessageBox, "main_view") | ||
|
||
msg_box = MessageBox(message, self.model, None) | ||
|
||
assert msg_box.recipient_emails == ["[email protected]"] | ||
|
@@ -753,6 +756,7 @@ def test_main_view(self, mocker, message, last_message): | |
"color": "#bd6", | ||
}, | ||
} | ||
self.model.controller.is_in_empty_narrow = False | ||
MessageBox(message, self.model, last_message) | ||
|
||
@pytest.mark.parametrize( | ||
|
@@ -1149,8 +1153,11 @@ def test_main_view_compact_output( | |
): | ||
message_fixture.update({"id": 4}) | ||
varied_message = dict(message_fixture, **to_vary_in_each_message) | ||
self.model.controller.is_in_empty_narrow = False | ||
msg_box = MessageBox(varied_message, self.model, varied_message) | ||
|
||
view_components = msg_box.main_view() | ||
|
||
assert len(view_components) == 1 | ||
assert isinstance(view_components[0], Padding) | ||
|
||
|
@@ -1160,7 +1167,9 @@ def test_main_view_generates_EDITED_label( | |
messages = messages_successful_response["messages"] | ||
for message in messages: | ||
self.model.index["edited_messages"].add(message["id"]) | ||
self.model.controller.is_in_empty_narrow = False | ||
msg_box = MessageBox(message, self.model, message) | ||
|
||
view_components = msg_box.main_view() | ||
|
||
label = view_components[0].original_widget.contents[0] | ||
|
@@ -1186,6 +1195,7 @@ def test_update_message_author_status( | |
): | ||
message = message_fixture | ||
last_msg = dict(message, **to_vary_in_last_message) | ||
self.model.controller.is_in_empty_narrow = False | ||
|
||
msg_box = MessageBox(message, self.model, last_msg) | ||
|
||
|
@@ -1389,6 +1399,7 @@ def test_keypress_EDIT_MESSAGE( | |
to_vary_in_each_message["subject"] = "" | ||
varied_message = dict(message_fixture, **to_vary_in_each_message) | ||
message_type = varied_message["type"] | ||
self.model.controller.is_in_empty_narrow = False | ||
msg_box = MessageBox(varied_message, self.model, message_fixture) | ||
size = widget_size(msg_box) | ||
msg_box.model.user_id = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters