Skip to content

Commit 7b853d5

Browse files
committed
tests: model: Extend other tests to incorporate both mentioned flags.
This commit expands some of the fixtures of present tests with the mentioned/wildcard_mentioned flags to make the tests more robust and generalized.
1 parent f907e6c commit 7b853d5

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/model/test_model.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ def test_toggle_stream_muted_status(
885885
(["read"], "add"),
886886
(["read", "starred"], "remove"),
887887
(["starred", "read"], "remove"),
888+
(["read", "mentioned", "wildcard_mentioned"], "add"),
889+
(["mentioned", "wildcard_mentioned", "starred"], "remove"),
888890
],
889891
)
890892
def test_toggle_message_star_status(
@@ -2075,11 +2077,18 @@ def test_update_star_status_invalid_operation(
20752077
("add", 1, ["read"], ["read", "starred"]),
20762078
("add", 1, ["starred"], ["starred"]),
20772079
("add", 1, ["read", "starred"], ["read", "starred"]),
2080+
("add", 1, ["mentioned"], ["mentioned", "starred"]),
2081+
("add", 1, ["mentioned", "starred"], ["mentioned", "starred"]),
2082+
("add", 1, ["wildcard_mentioned"], ["wildcard_mentioned", "starred"]),
20782083
("remove", -1, [], []),
20792084
("remove", -1, ["read"], ["read"]),
20802085
("remove", -1, ["starred"], []),
20812086
("remove", -1, ["read", "starred"], ["read"]),
20822087
("remove", -1, ["starred", "read"], ["read"]),
2088+
("remove", -1, ["mentioned"], ["mentioned"]),
2089+
("remove", -1, ["wildcard_mentioned"], ["wildcard_mentioned"]),
2090+
("remove", -1, ["mentioned", "starred"], ["mentioned"]),
2091+
("remove", -1, ["wildcard_mentioned", "starred"], ["wildcard_mentioned"]),
20832092
],
20842093
)
20852094
def test_update_star_status(
@@ -2098,7 +2107,23 @@ def test_update_star_status(
20982107

20992108
model.index = dict(
21002109
messages={msg_id: {"flags": flags_before} for msg_id in indexed_ids},
2101-
unread_mentioned_msg_ids=set(),
2110+
mentioned_msg_ids=set(
2111+
[
2112+
msg_id
2113+
for msg_id in indexed_ids
2114+
if {"mentioned", "wildcard_mentioned"} & set(flags_before)
2115+
]
2116+
),
2117+
unread_mentioned_msg_ids=set(
2118+
[
2119+
msg_id
2120+
for msg_id in indexed_ids
2121+
if (
2122+
{"mentioned", "wildcard_mentioned"} & set(flags_before)
2123+
and "read" not in flags_before
2124+
)
2125+
]
2126+
),
21022127
starred_msg_ids=set(
21032128
[msg_id for msg_id in indexed_ids if "starred" in flags_before]
21042129
),
@@ -2159,11 +2184,19 @@ def test_update_star_status(
21592184
("add", ["read"], ["read"]),
21602185
("add", ["starred"], ["starred", "read"]),
21612186
("add", ["read", "starred"], ["read", "starred"]),
2187+
("add", ["mentioned"], ["mentioned", "read"]),
2188+
("add", ["read", "mentioned"], ["read", "mentioned"]),
2189+
("add", ["mentioned", "starred"], ["mentioned", "starred", "read"]),
2190+
("add", ["wildcard_mentioned"], ["wildcard_mentioned", "read"]),
21622191
("remove", [], []),
21632192
("remove", ["read"], ["read"]), # msg cannot be marked 'unread'
21642193
("remove", ["starred"], ["starred"]),
2194+
("remove", ["mentioned"], ["mentioned"]),
21652195
("remove", ["starred", "read"], ["starred", "read"]),
21662196
("remove", ["read", "starred"], ["read", "starred"]),
2197+
("remove", ["read", "mentioned"], ["read", "mentioned"]),
2198+
("remove", ["wildcard_mentioned"], ["wildcard_mentioned"]),
2199+
("remove", ["read", "wildcard_mentioned"], ["read", "wildcard_mentioned"]),
21672200
],
21682201
)
21692202
def test_update_read_status(

0 commit comments

Comments
 (0)