Established Participants and Tickets model. Migrated concepts.
This commit is contained in:
parent
0df93e1886
commit
cd8e1e3b3b
22 changed files with 1345 additions and 191 deletions
|
|
@ -61,13 +61,13 @@ func TestImportGenericFormat(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestImportPartySizeDedup(t *testing.T) {
|
||||
func TestImportDedup(t *testing.T) {
|
||||
app := testApp(t)
|
||||
admin := testAdminUser(t, app)
|
||||
token := testToken(t, app, admin)
|
||||
mux := testMux(app)
|
||||
|
||||
// 3 rows same name+order = 1 record, party_size=3
|
||||
// 3 rows with same order number: first inserts, remaining 2 skip (same external_id)
|
||||
csv := "Patron Name,Patron Email,Order Number,Tier Name\nTitania,titania@test.com,ORD-1,GA\nTitania,titania@test.com,ORD-1,GA\nTitania,titania@test.com,ORD-1,GA\n"
|
||||
w := postCSV(t, mux, token, csv)
|
||||
|
||||
|
|
@ -75,16 +75,16 @@ func TestImportPartySizeDedup(t *testing.T) {
|
|||
if result["inserted"] != float64(1) {
|
||||
t.Errorf("inserted = %v, want 1", result["inserted"])
|
||||
}
|
||||
if result["grouped"] != float64(2) {
|
||||
t.Errorf("grouped = %v, want 2", result["grouped"])
|
||||
if result["skipped"] != float64(2) {
|
||||
t.Errorf("skipped = %v, want 2", result["skipped"])
|
||||
}
|
||||
|
||||
attendees, _ := app.listAttendees("", "", "")
|
||||
if len(attendees) != 1 {
|
||||
t.Fatalf("attendee count = %d, want 1", len(attendees))
|
||||
tickets, _ := app.listTickets(nil, "")
|
||||
if len(tickets) != 1 {
|
||||
t.Fatalf("ticket count = %d, want 1", len(tickets))
|
||||
}
|
||||
if attendees[0].PartySize != 3 {
|
||||
t.Errorf("party_size = %d, want 3", attendees[0].PartySize)
|
||||
if tickets[0].Source != "crowdwork" {
|
||||
t.Errorf("source = %q, want crowdwork", tickets[0].Source)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,8 @@ func TestImportReimportSkips(t *testing.T) {
|
|||
token := testToken(t, app, admin)
|
||||
mux := testMux(app)
|
||||
|
||||
csv := "name\nTitania\nOberon\n"
|
||||
// Use ticket_ids so re-import dedup works via UNIQUE(source, external_id)
|
||||
csv := "name,email,ticket_id\nTitania,titania@test.com,T001\nOberon,oberon@test.com,T002\n"
|
||||
postCSV(t, mux, token, csv)
|
||||
|
||||
// Re-import same data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue