From baaa4ce7613de0d80402874dd277da8bd05f7697 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 22 Dec 2015 21:26:29 +0100 Subject: improved session testing diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index aeb7194..dee6b37 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -86,12 +86,21 @@ func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) { ctx.ClearShowCarts = true ctx.SourceUri = "http://www.tonycuffe.com/mp3/tail%20toddle.mp3" - id, session, err := store.New(ctx) + id, _, err := store.New(ctx) if err != nil { rhl.Printf("MAIN: Error SessionStore.New(): %s", err) return } + var session *rhimport.SessionChan + if session, err = store.Get(ctx.UserName, ""); err != nil { + rhl.Printf("MAIN: (Expected) Error SessionStore.Get(): %s", err) + } + if session, err = store.Get(ctx.UserName, id); err != nil { + rhl.Printf("MAIN: Error SessionStore.Get(): %s", err) + return + } + pch := make(chan string, 1000) if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress1); err != nil { rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err) @@ -101,7 +110,7 @@ func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) { rhl.Printf("MAIN: Error Session.AddDoneHandler(): %s", err) } - rhl.Printf("MAIN: calling run for heslinki/%s", id) + rhl.Printf("MAIN: calling run for %s/%s", ctx.UserName, id) session.Run() time.Sleep(500 * time.Millisecond) @@ -120,8 +129,8 @@ func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) { } } - rhl.Printf("MAIN: calling remove for heslinki/%s", id) - if err = store.Remove("heslinki", id); err != nil { + rhl.Printf("MAIN: calling remove for %s/%s", ctx.UserName, id) + if err = store.Remove(ctx.UserName, id); err != nil { rhl.Printf("MAIN: Error SessionStore.Remove(): %s", err) } -- cgit v0.10.2