def test_header_table_customer(self, mocker, company_name, html_address, concated_name): user = mocker.create_autospec(User(), spec_set=True) user.name = "" user.mail = "" user.gender_suffix = "" user.phone = "" customer = mocker.create_autospec(Customer(), spec_set=True) customer.id = 1 customer.company_name = company_name customer.concated_name = concated_name customer.html_address = html_address offer = Offer(user) offer.date = date(2020, 12, 15) offer.customer = customer header_table = offer.header_table() expected = f""" Dla:<br /> <b>{company_name}</b><br /> {html_address}<br /> {concated_name} """ assert_that(header_table, contains_string(expected))
def test_header_table_date(self, mocker, offer_date, expected_date): user = mocker.create_autospec(User(), spec_set=True) user.name = "" user.mail = "" user.gender_suffix = "" user.phone = "" offer = Offer(user) offer.date = offer_date header_table = offer.header_table() expected = f"Z dnia: {expected_date}<br />" assert_that(header_table, contains_string(expected))
def test_header_table_symbol(self, mocker, symbol): user = mocker.create_autospec(User(), spec_set=True) user.name = "" user.mail = "" user.gender_suffix = "" user.phone = "" offer = Offer(user) offer.date = date(2020, 12, 15) offer.symbol = symbol header_table = offer.header_table() expected = f"Oferta nr: <b>{symbol}</b><br />" assert_that(header_table, contains_string(expected))
def test_header_table_author_no_phone(self, mocker, company, name, mail): user = mocker.create_autospec(User(), spec_set=True) user.name = name user.mail = mail user.phone = None offer = Offer(user) offer.company_address = company offer.date = date(2020, 12, 15) header_table = offer.header_table() expected = f""" <td width=315> {company}<br /> <b>{name}</b><br /> {mail}<br /> """ assert_that(header_table, contains_string(expected)) assert_that(header_table, not_(contains_string("Tel")))
def test_footer(self, mocker, suffix, name, order_mail): user = mocker.create_autospec(User(), spec_set=True) user.name = name user.gender_suffix = suffix offer = Offer(user) offer.order_email = order_mail offer.date = date(2020, 12, 15) header_table = offer.footer() expected = f""" <p> <b>Zamówienia prosimy kierować na adres:</b> {order_mail} z kopią do autora oferty.<br /> <br /> Łączymy pozdrowienia. </p> <p align=center style="margin-left: 500"> Ofertę przygotował{suffix}<br /><br /><br /> {name} </p> """ assert_that(header_table, contains_string(expected))