chiark / gitweb /
more schedule testing
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 24 May 2008 18:42:07 +0000 (19:42 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 24 May 2008 18:42:07 +0000 (19:42 +0100)
tests/schedule.py

index ac0b438..178871f 100755 (executable)
@@ -172,7 +172,22 @@ def test():
         assert False, "checking schedule_add failed"
     except disorder.operationError:
       pass                              # good
-        
+    print " checking scheduled events survive restarts"
+    c.schedule_add(now + 4, "normal", "play", track)
+    dtest.stop_daemon()
+    dtest.start_daemon()
+    c = disorder.client()
+    print " waiting for track to play"
+    waited = 0
+    p = c.playing()
+    while p is None and waited < 10:
+        time.sleep(1)
+        print "  ."
+        waited += 1
+        p = c.playing()
+    assert waited < 10, "checking track played within a reasonable period"
+    assert p["track"] == track, "checking right track played"
+    assert c.schedule_list() == [], "checking schedule is empty"
 
 if __name__ == '__main__':
     dtest.run()