python27 lines · 744 B
1from report import Crumb, format_crumb
2
3
4def test_crumb_without_permalink_is_dropped():
5 c = Crumb(author_id="U1", author_name="Ada", claim="shipped", permalink="")
6 assert format_crumb(c) is None
7
8
9def test_unresolved_author_is_not_named():
10 c = Crumb(
11 author_id="U0NONE01",
12 author_name="",
13 claim="thank you",
14 permalink="https://example.slack.com/archives/C0OPS03/p1",
15 )
16 line = format_crumb(c)
17 assert line is not None
18 assert "Ada" not in line
19 assert "" in line
20 assert "https://example.slack.com/archives/C0OPS03/p1" in line
21
22
23if __name__ == "__main__":
24 test_crumb_without_permalink_is_dropped()
25 test_unresolved_author_is_not_named()
26 print("ok")
27