From a5e92800477f6195a6b2e8c6e64a56859117d5b8 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 29 Sep 2019 18:12:48 +0200 Subject: Pass a message to add_message instead of messed up kwargs everywhere Changes LOTS of things --- test/test_ui/test_render.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_ui/test_render.py b/test/test_ui/test_render.py index d13751d1..57bd05c9 100644 --- a/test/test_ui/test_render.py +++ b/test/test_ui/test_render.py @@ -4,7 +4,7 @@ from datetime import datetime from poezio.theming import get_theme from poezio.ui.render import build_lines, Line, write_pre from poezio.ui.consts import SHORT_FORMAT -from poezio.ui.types import BaseMessage, Message, XMLLog +from poezio.ui.types import BaseMessage, Message, StatusMessage, XMLLog def test_simple_build_basemsg(): msg = BaseMessage(txt='coucou') @@ -28,6 +28,17 @@ def test_simple_render_separator(): line = build_lines(None, 100, True, 10)[0] assert line is None + +def test_simple_render_status(): + class Obj: + name = 'toto' + msg = StatusMessage("Coucou {name}", {'name': lambda: Obj.name}) + assert msg.txt == "Coucou toto" + Obj.name = 'titi' + build_lines(msg, 100, True, 10)[0] + assert msg.txt == "Coucou titi" + + class FakeBuffer: def __init__(self): self.text = '' -- cgit v1.2.3