def test_order_for_self_to_order_for_self_and_others(self): order = factories.create_pending_order_for_self() actions.update_pending_order(order, 'individual', days_for_self=['fri', 'sat', 'sun'], email_addrs_and_days_for_others=[ ('*****@*****.**', ['fri', 'sat']), ('*****@*****.**', ['sat', 'sun']), ]) self.assertEqual(order.status, 'pending') self.assertEqual(order.rate, 'individual') self.assertEqual(order.ticket_details(), [ { 'name': 'Alice', 'days': 'Friday, Saturday, Sunday', 'cost_incl_vat': 126, 'cost_excl_vat': 105 }, { 'name': '*****@*****.**', 'days': 'Friday, Saturday', 'cost_incl_vat': 90, 'cost_excl_vat': 75 }, { 'name': '*****@*****.**', 'days': 'Saturday, Sunday', 'cost_incl_vat': 90, 'cost_excl_vat': 75 }, ])
def test_order_for_self_to_order_for_self(self): order = factories.create_pending_order_for_self() actions.update_pending_order( order, 'individual', days_for_self=['fri'], ) self.assertEqual(order.status, 'pending') self.assertEqual(order.rate, 'individual') self.assertEqual(order.ticket_details(), [{ 'name': 'Alice', 'days': 'Friday', 'cost_incl_vat': 54, 'cost_excl_vat': 45 }])
def test_order_for_self_to_order_for_self_and_others(self): order = factories.create_pending_order_for_self() actions.update_pending_order( order, billing_details={'name': 'Alice Apple', 'addr': 'Eadrax, Sirius Tau'}, rate='individual', days_for_self=['sun', 'mon', 'tue'], email_addrs_and_days_for_others=[ ('*****@*****.**', 'Bob', ['sun', 'mon']), ('*****@*****.**', 'Carol', ['mon', 'tue']), ] ) self.assertEqual(order.status, 'pending') self.assertEqual(order.invoice_number, None) self.assertEqual(order.billing_name, 'Alice Apple') self.assertEqual(order.billing_addr, 'Eadrax, Sirius Tau') [row1, row2, row3] = order.all_order_rows() self.assertEqual(row1.cost_excl_vat, 125) self.assertEqual(row1.item_descr, '3-day individual-rate ticket') self.assertEqual(row1.item_descr_extra, 'Sunday, Monday, Tuesday') ticket1 = row1.item self.assertEqual(ticket1.owner, order.purchaser) self.assertEqual(ticket1.rate, 'individual') self.assertEqual(ticket1.days(), ['Sunday', 'Monday', 'Tuesday']) self.assertEqual(row2.cost_excl_vat, 95) self.assertEqual(row2.item_descr, '2-day individual-rate ticket') self.assertEqual(row2.item_descr_extra, 'Sunday, Monday') ticket2 = row2.item self.assertEqual(ticket2.owner, None) self.assertEqual(ticket2.rate, 'individual') self.assertEqual(ticket2.days(), ['Sunday', 'Monday']) self.assertEqual(row3.cost_excl_vat, 95) self.assertEqual(row3.item_descr, '2-day individual-rate ticket') self.assertEqual(row3.item_descr_extra, 'Monday, Tuesday') ticket3 = row3.item self.assertEqual(ticket3.owner, None) self.assertEqual(ticket3.rate, 'individual') self.assertEqual(ticket3.days(), ['Monday', 'Tuesday'])
def test_corporate_order_to_individual_order(self): order = factories.create_pending_order_for_self(rate='corporate') actions.update_pending_order( order, 'individual', days_for_self=['fri', 'sat', 'sun'], ) self.assertEqual(order.status, 'pending') self.assertEqual(order.rate, 'individual') self.assertEqual(order.company_name, None) self.assertEqual(order.company_addr, None) self.assertEqual(order.ticket_details(), [ { 'name': 'Alice', 'days': 'Friday, Saturday, Sunday', 'cost_incl_vat': 126, 'cost_excl_vat': 105 }, ])
def test_order_for_self_to_order_for_self(self): order = factories.create_pending_order_for_self() actions.update_pending_order( order, billing_details={'name': 'Alice Apple', 'addr': 'Eadrax, Sirius Tau'}, rate='individual', days_for_self=['sun'], ) self.assertEqual(order.status, 'pending') self.assertEqual(order.invoice_number, None) self.assertEqual(order.billing_name, 'Alice Apple') self.assertEqual(order.billing_addr, 'Eadrax, Sirius Tau') [row] = order.all_order_rows() self.assertEqual(row.cost_excl_vat, 65) self.assertEqual(row.item_descr, '1-day individual-rate ticket') self.assertEqual(row.item_descr_extra, 'Sunday') ticket = row.item self.assertEqual(ticket.owner, order.purchaser) self.assertEqual(ticket.rate, 'individual') self.assertEqual(ticket.days(), ['Sunday'])
def test_individual_order_to_corporate_order(self): order = factories.create_pending_order_for_self() actions.update_pending_order( order, billing_details={'name': 'Sirius Cybernetics Corp.', 'addr': 'Eadrax, Sirius Tau'}, rate='corporate', days_for_self=['sun', 'mon', 'tue'], ) self.assertEqual(order.status, 'pending') self.assertEqual(order.invoice_number, None) self.assertEqual(order.billing_name, 'Sirius Cybernetics Corp.') self.assertEqual(order.billing_addr, 'Eadrax, Sirius Tau') [row] = order.all_order_rows() self.assertEqual(row.cost_excl_vat, 255) self.assertEqual(row.item_descr, '3-day corporate-rate ticket') self.assertEqual(row.item_descr_extra, 'Sunday, Monday, Tuesday') ticket = row.item self.assertEqual(ticket.owner, order.purchaser) self.assertEqual(ticket.rate, 'corporate') self.assertEqual(ticket.days(), ['Sunday', 'Monday', 'Tuesday'])
def test_individual_order_to_corporate_order(self): order = factories.create_pending_order_for_self() actions.update_pending_order( order, 'corporate', days_for_self=['fri', 'sat', 'sun'], company_details={ 'name': 'Sirius Cybernetics Corp.', 'addr': 'Eadrax, Sirius Tau', }, ) self.assertEqual(order.status, 'pending') self.assertEqual(order.rate, 'corporate') self.assertEqual(order.company_name, 'Sirius Cybernetics Corp.') self.assertEqual(order.company_addr, 'Eadrax, Sirius Tau') self.assertEqual(order.ticket_details(), [ { 'name': 'Alice', 'days': 'Friday, Saturday, Sunday', 'cost_incl_vat': 252, 'cost_excl_vat': 210 }, ])