krz/daily-poem
Poetry emailed, at your will.
clone: git clone https://gitbay.org/krz/daily-poem.git
215f74e70653a33420a681812d0b1405d2551407
verified · cmc
author: Christian Cleberg <hello@cleberg.net> · 2026-08-23T02:20:34Z
tests/test_main.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) @@ -24,21 +24,22 @@ class TestBuildMessage(unittest.TestCase): self.assertIn("one\ntwo", msg.get_payload()) +PAYLOAD = [ + { + "title": "Sonnet", + "author": "Anon", + "linecount": "2", + "lines": ["first line", "second line"], + } +] + + class TestFetchPoem(unittest.TestCase): """PoetryDB is stubbed: the test covers the shape this code expects from it, not the service being up.""" - PAYLOAD = [ - { - "title": "Sonnet", - "author": "Anon", - "linecount": "2", - "lines": ["first line", "second line"], - } - ] - def test_fields_are_extracted_and_lines_joined(self): - with patch("main.requests.get", return_value=FakeResponse(self.PAYLOAD)): + with patch("main.requests.get", return_value=FakeResponse(PAYLOAD)): title, author, line_count, lines = fetch_poem() self.assertEqual(title, "Sonnet")