summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/main.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-22 20:26:29 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-22 20:26:29 (GMT)
commitbaaa4ce7613de0d80402874dd277da8bd05f7697 (patch)
tree085a02c772e9ce7e6dbd924a302003988320ec2a /src/helsinki.at/rhimportd/main.go
parentbfb049d3121c29ea37f2ce840723b0225fba4a81 (diff)
improved session testing
Diffstat (limited to 'src/helsinki.at/rhimportd/main.go')
-rw-r--r--src/helsinki.at/rhimportd/main.go17
1 files changed, 13 insertions, 4 deletions
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, "<test>"); 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)
}