From 492c345e355d2ab38bf8fc331f30d7c9df119a0f Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 22 Oct 2020 11:41:25 +0100 Subject: building the template string --- ctrack/register/tests/test_css.py | 55 ++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'ctrack/register/tests') diff --git a/ctrack/register/tests/test_css.py b/ctrack/register/tests/test_css.py index b0e3589..1b72a23 100644 --- a/ctrack/register/tests/test_css.py +++ b/ctrack/register/tests/test_css.py @@ -16,7 +16,7 @@ class TagAttributes(NamedTuple): def tag_attrs(event) -> TagAttributes: if event.type_descriptor == EventType.CAF_INITIAL_CAF_RECEIVED.name: return TagAttributes( - inline_style="style=\"background-color: green; color: white;\"", + inline_style='style="background-color: green; color: white;"', id_str="caf-initial-received-event", ) @@ -26,7 +26,7 @@ def tag_attrs(event) -> TagAttributes: [ ( EventType.CAF_INITIAL_CAF_RECEIVED.name, - "style=\"background-color: green; color: white;\"", + 'style="background-color: green; color: white;"', "caf-initial-received-event", ) ], @@ -39,15 +39,17 @@ def test_can_get_class_string(caf, user, e_type, css_str, id_str): assert tag_attrs(event).id_str == id_str -template = ("\n" - " {0}\n" - " CAF Initial Submitted\n" - " CAF Reviewed\n" - " OES Revisions Submitted\n" - " Validation Agreed\n" - " Improvement Plan Submitted\n" - " Improvement Plan Review\n" - "\n") +template = ( + "\n" + " {0}\n" + " {1}\n" + " CAF Reviewed\n" + " OES Revisions Submitted\n" + " Validation Agreed\n" + " Improvement Plan Submitted\n" + " Improvement Plan Review\n" + "\n" +) class Swimlane: @@ -58,8 +60,17 @@ class Swimlane: @property def tr(self): + initial_submitted_str = "".join( + [ + "", + self.slots.initial_submitted.type_descriptor, + "" + ] + ) return template.format( - self.org_name, tag_attrs(self.slots.initial_submitted).inline_style + self.org_name, initial_submitted_str ) @@ -97,15 +108,17 @@ def test_swimlane_slots(): def test_progress_chart_slots(caf, user): - accept = ("\n" - " {}\n" - " CAF Initial Submitted\n" - " CAF Reviewed\n" - " OES Revisions Submitted\n" - " Validation Agreed\n" - " Improvement Plan Submitted\n" - " Improvement Plan Review\n" - "\n") + accept = ( + "\n" + " {}\n" + ' CAF_INITIAL_CAF_RECEIVED\n' + " CAF Reviewed\n" + " OES Revisions Submitted\n" + " Validation Agreed\n" + " Improvement Plan Submitted\n" + " Improvement Plan Review\n" + "\n" + ) org_name = caf.organisation.name caf_initial = CAFSingleDateEvent.objects.create( type_descriptor=EventType.CAF_INITIAL_CAF_RECEIVED.name, -- cgit v1.2.3