def test_csv_simple(event): c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name', 'questions': [] }) assert clean(content.decode()) == clean(""""Order code","Attendee name","Attendee name: Title","Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price","Checked in","Secret", "E-mail","Company","Voucher code" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","","" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","","" """)
def test_csv_simple(event): c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean(""""Order code","Attendee name","Attendee name: Title","Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price","Checked in","Checked out","Automatically checked in","Secret","E-mail","Company","Voucher code","Order date","Requires special attention","Comment","Seat ID","Seat name", "Seat zone","Seat row","Seat number" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","","","2019-02-22","No","","","","","","" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","","No","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","","","2019-02-22","No","","","","","","" """)
def test_csv_order_by_name_parts(event): # noqa from django.conf import settings if not settings.JSON_FIELD_AVAILABLE: raise pytest.skip("Not supported on this database") c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:given_name', 'questions': [] }) assert clean(content.decode()) == clean(""""Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Secret","E-mail","Company","Voucher code" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","","" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","","" """) c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:family_name', 'questions': [] }) assert clean(content.decode()) == clean(""""Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Secret","E-mail","Company","Voucher code" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","","" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","","" """)
def test_csv_order_by_name_parts(event): # noqa from django.conf import settings if not settings.JSON_FIELD_AVAILABLE: raise pytest.skip("Not supported on this database") c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:given_name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean( """"Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Checked out","Automatically checked in","Secret","E-mail","Phone number","Company","Voucher code","Order date","Order time","Requires special attention","Comment","Seat ID","Seat name","Seat zone","Seat row","Seat number","Address","ZIP code","City","Country","State" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","","No","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","'+498912345678","","","2019-02-22","14:00:00","No","","","","","","","","","","","" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","'+498912345678","","","2019-02-22","14:00:00","No","","","","","","","","","","","" """) c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:family_name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean( """"Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Checked out","Automatically checked in","Secret","E-mail","Phone number","Company","Voucher code","Order date","Order time","Requires special attention","Comment","Seat ID","Seat name","Seat zone","Seat row","Seat number","Address","ZIP code","City","Country","State" "FOO","Mr Peter A Jones","Mr","Peter","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","'+498912345678","","","2019-02-22","14:00:00","No","","","","","","","","","","","" "FOO","Mrs Andrea J Zulu","Mrs","Andrea","J","Zulu","Ticket","13.00","","","No","ggsngqtnmhx74jswjngw3fk8pfwz2a7k", "*****@*****.**","'+498912345678","","","2019-02-22","14:00:00","No","","","","","","","","","","","" """)
def test_csv_order_by_inherited_name_parts(event): # noqa from django.conf import settings if not settings.JSON_FIELD_AVAILABLE: raise pytest.skip("Not supported on this database") with scope(organizer=event.organizer): OrderPosition.objects.filter( attendee_name_cached__icontains="Andrea").delete() op = OrderPosition.objects.get() op.attendee_name_parts = {} op.save() order2 = Order.objects.create( code='BAR', event=event, email='*****@*****.**', phone='+498912345678', status=Order.STATUS_PAID, datetime=datetime.datetime(2019, 2, 22, 14, 0, 0, tzinfo=pytz.UTC), expires=now() + datetime.timedelta(days=10), total=33, locale='en') OrderPosition.objects.create(order=order2, item=event.items.first(), variation=None, company='BARCORP', price=Decimal("23"), secret='hutjztuxhkbtwnesv2suqv26k6ttytyy') InvoiceAddress.objects.create(order=event.orders.get(code='BAR'), company='FOOCORP', name_parts={ "title": "Mr", "given_name": "Albert", "middle_name": "J", "family_name": "Zulu", "_scheme": "title_given_middle_family" }) InvoiceAddress.objects.create(order=event.orders.get(code='FOO'), company='FOOCORP', name_parts={ "title": "Mr", "given_name": "Paul", "middle_name": "A", "family_name": "Jones", "_scheme": "title_given_middle_family" }) c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean( """"Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Checked out","Automatically checked in","Secret","E-mail","Phone number","Company","Voucher code","Order date","Order time","Requires special attention","Comment","Seat ID","Seat name","Seat zone","Seat row","Seat number","Address","ZIP code","City","Country","State" "BAR","Mr Albert J Zulu","Mr","Albert","J","Zulu","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytyy", "*****@*****.**","'+498912345678","BARCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" "FOO","Mr Paul A Jones","Mr","Paul","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","'+498912345678","FOOCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" """) c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:given_name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean( """"Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Checked out","Automatically checked in","Secret","E-mail","Phone number","Company","Voucher code","Order date","Order time","Requires special attention","Comment","Seat ID","Seat name","Seat zone","Seat row","Seat number","Address","ZIP code","City","Country","State" "BAR","Mr Albert J Zulu","Mr","Albert","J","Zulu","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytyy", "*****@*****.**","'+498912345678","BARCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" "FOO","Mr Paul A Jones","Mr","Paul","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","'+498912345678","FOOCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" """) c = CSVCheckinList(event) _, _, content = c.render({ 'list': event.checkin_lists.first().pk, 'secrets': True, 'sort': 'name:family_name', '_format': 'default', 'questions': [] }) assert clean(content.decode()) == clean( """"Order code","Attendee name","Attendee name: Title", "Attendee name: First name","Attendee name: Middle name","Attendee name: Family name","Product","Price", "Checked in","Checked out","Automatically checked in","Secret","E-mail","Phone number","Company","Voucher code","Order date","Order time","Requires special attention","Comment","Seat ID","Seat name","Seat zone","Seat row","Seat number","Address","ZIP code","City","Country","State" "FOO","Mr Paul A Jones","Mr","Paul","A","Jones","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytxx", "*****@*****.**","'+498912345678","FOOCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" "BAR","Mr Albert J Zulu","Mr","Albert","J","Zulu","Ticket","23.00","","","No","hutjztuxhkbtwnesv2suqv26k6ttytyy", "*****@*****.**","'+498912345678","BARCORP","","2019-02-22","14:00:00","No","","","","","","","","","","","" """)