@pytest.mark.django_db
def test_order_package_children_taxes():
 tax_class = get_default_tax_class()
 tax = Tax.objects.create(rate=u'0.25', name=u'Da Tax')
 TaxRule.objects.create(tax=tax).tax_classes.add(tax_class)
 source = get_order_source_with_a_package()
 assert (source.get_lines()[0].tax_class == tax_class)
 order = OrderCreator().create_order(source)
 lines_and_taxes = []
 for line in order.lines.all():
  lines_and_taxes.append(prettify_order_line(line))
  for line_tax in line.taxes.all():
   lines_and_taxes.append((u'  %s' % (line_tax,)))
 assert (lines_and_taxes == [u'#0 10 x PackageParent', u'  Da Tax: 20.000000000 EUR on 80.000000000 EUR', u'#1   10 x PackageChild-0, child of #0', u'#2   20 x PackageChild-1, child of #0', u'#3   30 x PackageChild-2, child of #0', u'#4   40 x PackageChild-3, child of #0'])

@ pytest . mark . django_db def test_order_package_children_taxes ( ) : tax_class = get_default_tax_class ( ) tax = Tax . objects . create ( rate = u'0.25' , name = u'Da Tax' ) TaxRule . objects . create ( tax = tax ) . tax_classes . add ( tax_class ) source = get_order_source_with_a_package ( ) assert ( source . get_lines ( ) [ 0 ] . tax_class == tax_class ) order = OrderCreator ( ) . create_order ( source ) lines_and_taxes = [ ] for line in order . lines . all ( ) : lines_and_taxes . append ( prettify_order_line ( line ) ) for line_tax in line . taxes . all ( ) : lines_and_taxes . append ( ( u'  %s' % ( line_tax , ) ) ) assert ( lines_and_taxes == [ u'#0 10 x PackageParent' , u'  Da Tax: 20.000000000 EUR on 80.000000000 EUR' , u'#1   10 x PackageChild-0, child of #0' , u'#2   20 x PackageChild-1, child of #0' , u'#3   30 x PackageChild-2, child of #0' , u'#4   40 x PackageChild-3, child of #0' ] )
test ordercreator creates package parent links for child lines .