Example #1
0
    def test_send_monthly_invoice(self):
        """Method to test monthly invoices"""

        with self.app.test_request_context():
            TicketFeesFactory(service_fee=10.23, maximum_fee=11)

            test_event = EventFactoryBasic(state='published')

            test_user = UserFactory()

            test_order = OrderFactory(status='completed')
            test_order.completed_at = datetime.datetime.now(
            ) - datetime.timedelta(days=30)
            test_order.amount = 100
            test_order.event = test_event

            test_ticket_holder = AttendeeFactory()
            test_ticket_holder.event = test_event
            test_ticket_holder.order = test_order

            test_event.owner = test_user
            db.session.commit()

            send_monthly_event_invoice()
            event_invoice = EventInvoice.query.get(1)
            self.assertEqual(event_invoice.amount, 10.23)
    def test_export_orders_csv(self):
        """Method to check the orders data export"""

        with self.app.test_request_context():
            test_order = OrderFactory()
            test_order.amount = 2
            field_data = export_orders_csv([test_order])
            self.assertEqual(field_data[1][2], 'initializing')
            self.assertEqual(field_data[1][4], '2')