def test_full_terms_table(self): remarks = "some remarks" test_terms = [ (TermType.delivery, "Warunki dostawy", "Some delivery terms text"), (TermType.offer, "Warunki oferty", "Some offer terms text"), (TermType.billing, "Warunki płatności", "Some billing terms text"), (TermType.delivery_date, "Termin dostawy", "Some delivery date terms text"), ] offer = Offer() offer.remarks = remarks offer.terms = {} for row in test_terms: term_type = row[0] offer.terms[term_type] = TermItem(term_type, row[2]) terms_table = offer.terms_table() for row in test_terms: expected_terms_text = f""" <tr> <td width=140>{row[1]}:</td> <td width=602>{row[2]}</td> </tr> """ assert_that(terms_table, contains_string(expected_terms_text)) expected_remarks_text = f""" <tr> <td width=140>Uwagi:</td> <td width=602>{remarks}</td> </tr> """ assert_that(terms_table, contains_string(expected_remarks_text))
def test_terms_table_remarks(self, remarks, expected_remarks): offer = Offer() offer.remarks = remarks terms_table = offer.terms_table() expected_terms_table = f""" <table cellspacing=3> <tr> <td width=140>Uwagi:</td> <td width=602>{expected_remarks}</td> </tr> </table> """ assert_that(terms_table, is_(equal_to_ignoring_whitespace(expected_terms_table)))
def test_terms_table_with_remarks(self, term_type, term_type_desc, remarks, expected_remarks): text = "Some terms text" offer = Offer() offer.remarks = remarks offer.terms = {term_type: (TermItem(term_type, text))} terms_table = offer.terms_table() expected_terms_table = f""" <table cellspacing=3> <tr> <td width=140>{term_type_desc}:</td> <td width=602>{text}</td> </tr> <tr> <td width=140>Uwagi:</td> <td width=602>{expected_remarks}</td> </tr> </table> """ assert_that(terms_table, is_(equal_to_ignoring_whitespace(expected_terms_table)))