Mercurial > silorider
comparison tests/test_format.py @ 48:486affad656e
Rewrite posting process with card system and more structured API
- The basic posting process is more opinionated so that silos have less code to
write, and dry-run posting is handled by default.
- Add "card" system where SiloRider is able to fetch the page of a post to
check for any custom summary or featured image. This is how Twitter,
Facebook, Discord, and many others come up with their "preview card" when
a link is posted.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 08 Oct 2023 13:47:28 -0700 |
parents | 9e4eb3f2754e |
children |
comparison
equal
deleted
inserted
replaced
47:4be321bd5ed4 | 48:486affad656e |
---|---|
79 'A test entry that is very very long because its... ' + test_url), | 79 'A test entry that is very very long because its... ' + test_url), |
80 ('A test entry that is very very long because its title has many many ' | 80 ('A test entry that is very very long because its title has many many ' |
81 'words in it for no good reason', 80, True, | 81 'words in it for no good reason', 80, True, |
82 'A test entry that is very very long because its... ' + test_url) | 82 'A test entry that is very very long because its... ' + test_url) |
83 ]) | 83 ]) |
84 def test_format_lonform_entry(title, limit, add_url, expected): | 84 def test_format_longform_entry(title, limit, add_url, expected): |
85 entry = _make_test_entry(title, False) | 85 entry = _make_test_entry(title, False) |
86 actual = format_entry(entry, limit, add_url) | 86 actual = format_entry(entry, limit=limit, add_url=add_url) |
87 assert actual == expected | 87 assert actual.text == expected |
88 | 88 |
89 | 89 |
90 @pytest.mark.parametrize("text, limit, add_url, expected", [ | 90 @pytest.mark.parametrize("text, limit, add_url, expected", [ |
91 ('A test entry', None, False, 'A test entry'), | 91 ('A test entry', None, False, 'A test entry'), |
92 ('A test entry', None, 'auto', 'A test entry'), | 92 ('A test entry', None, 'auto', 'A test entry'), |
107 'words in it for no good reason', 80, True, | 107 'words in it for no good reason', 80, True, |
108 'A test entry that is very very long because its... ' + test_url) | 108 'A test entry that is very very long because its... ' + test_url) |
109 ]) | 109 ]) |
110 def test_format_micropost_entry(text, limit, add_url, expected): | 110 def test_format_micropost_entry(text, limit, add_url, expected): |
111 entry = _make_test_entry(text, True) | 111 entry = _make_test_entry(text, True) |
112 actual = format_entry(entry, limit, add_url) | 112 actual = format_entry(entry, limit=limit, add_url=add_url) |
113 assert actual == expected | 113 assert actual.text == expected |