def test_merchandise_table_with_minimum_subset(self): offer = Offer() offer.merchandise_list = MerchandiseListModel(offer) offer.merchandise_list.add_item(create_merch()) merchandise_table = offer.merchanidse_table( PrintOptions(False, True, False, False, False, False, False, True)) expected_merchandise_table = """ <table cellspacing=0> <thead><tr class="header"> <td width=655 align=left><b>Towar</b></td> <td width=90 align=right><b>Wartość</b></td> </tr></thead> <tr class="row1"> <td>CODE</td> <td align=right>8.99 zł</td> </tr> <tr style="font-weight:bold;"> <td align=right colspan=1>Razem:</td> <td align=right>8.99 zł</td> </tr> </table> """ assert_that( merchandise_table, is_(equal_to_ignoring_whitespace(expected_merchandise_table)))
def test_empty_merchandise_table(self): offer = Offer() offer.merchandise_list = MerchandiseListModel(offer) merchandise_table = offer.merchanidse_table() expected_merchandise_table = """ <table cellspacing=0> <thead><tr class="header"> <td width=40 align=left><b>Lp.</b></td> <td width=285 align=left><b>Towar</b></td> <td width=90 align=right><b>Cena kat.</b></td> <td width=75 align=right><b>Rabat</b></td> <td width=90 align=right><b>Cena</b></td> <td width=75 align=right><b>Ilość</b></td> <td width=90 align=right><b>Wartość</b></td> </tr></thead> <tr style="font-weight:bold;"> <td align=right colspan=6>Razem:</td> <td align=right>0.00 zł</td> </tr> </table> """ assert_that( merchandise_table, is_(equal_to_ignoring_whitespace(expected_merchandise_table)))
def test_merchandise_table_with_all_columns(self): offer = Offer() offer.merchandise_list = MerchandiseListModel(offer) offer.merchandise_list.add_item(create_merch()) merchandise_table = offer.merchanidse_table() expected_merchandise_table = """ <table cellspacing=0> <thead><tr class="header"> <td width=40 align=left><b>Lp.</b></td> <td width=285 align=left><b>Towar</b></td> <td width=90 align=right><b>Cena kat.</b></td> <td width=75 align=right><b>Rabat</b></td> <td width=90 align=right><b>Cena</b></td> <td width=75 align=right><b>Ilość</b></td> <td width=90 align=right><b>Wartość</b></td> </tr></thead> <tr class="row1"> <td align=right style="padding-right: 5">1</td> <td>CODE</td> <td align=right>9.99 zł</td> <td align=right>10.0%</td> <td align=right>8.99 zł</td> <td align=right>1 szt.</td> <td align=right>8.99 zł</td> </tr> <tr class="row1 spec"> <td></td> <td colspan=6>DESCR</td> </tr> <tr style="font-weight:bold;"> <td align=right colspan=6>Razem:</td> <td align=right>8.99 zł</td> </tr> </table> """ assert_that( merchandise_table, is_(equal_to_ignoring_whitespace(expected_merchandise_table)))
def test_merchandise_table_without_list_price_and_discount(self): offer = Offer() offer.merchandise_list = MerchandiseListModel(offer) offer.merchandise_list.add_item(create_merch()) merchandise_table = offer.merchanidse_table( PrintOptions(print_list_price=False, print_discount=False)) expected_merchandise_table = """ <table cellspacing=0> <thead><tr class="header"> <td width=40 align=left><b>Lp.</b></td> <td width=450 align=left><b>Towar</b></td> <td width=90 align=right><b>Cena</b></td> <td width=75 align=right><b>Ilość</b></td> <td width=90 align=right><b>Wartość</b></td> </tr></thead> <tr class="row1"> <td align=right style="padding-right: 5">1</td> <td>CODE</td> <td align=right>8.99 zł</td> <td align=right>1 szt.</td> <td align=right>8.99 zł</td> </tr> <tr class="row1 spec"> <td></td> <td colspan=4>DESCR</td> </tr> <tr style="font-weight:bold;"> <td align=right colspan=4>Razem:</td> <td align=right>8.99 zł</td> </tr> </table> """ assert_that( merchandise_table, is_(equal_to_ignoring_whitespace(expected_merchandise_table)))