2014-05-02 17:22:05 -05:00
|
|
|
package pebble
|
|
|
|
|
|
|
|
import (
|
2014-06-13 14:18:57 -07:00
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
"testing"
|
2014-05-02 17:22:05 -05:00
|
|
|
)
|
|
|
|
|
2014-06-13 16:01:39 -07:00
|
|
|
func initTestPebbleDriver() *PebbleDriver {
|
|
|
|
return NewPebbleDriver(NewPebbleAdaptor("adaptor"), "pebble")
|
2014-06-13 14:18:57 -07:00
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 16:01:39 -07:00
|
|
|
func TestPebbleDriverStart(t *testing.T) {
|
|
|
|
d := initTestPebbleDriver()
|
2014-07-17 11:41:47 -07:00
|
|
|
gobot.Assert(t, d.Start(), true)
|
2014-06-13 14:18:57 -07:00
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 16:01:39 -07:00
|
|
|
func TestPebbleDriverHalt(t *testing.T) {
|
|
|
|
d := initTestPebbleDriver()
|
2014-07-17 11:41:47 -07:00
|
|
|
gobot.Assert(t, d.Halt(), true)
|
2014-06-13 14:18:57 -07:00
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 16:01:39 -07:00
|
|
|
func TestPebbleDriverNotification(t *testing.T) {
|
|
|
|
d := initTestPebbleDriver()
|
|
|
|
d.SendNotification("Hello")
|
|
|
|
d.SendNotification("World")
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-07-17 11:41:47 -07:00
|
|
|
gobot.Assert(t, d.Messages[0], "Hello")
|
|
|
|
gobot.Assert(t, d.PendingMessage(), "Hello")
|
|
|
|
gobot.Assert(t, d.PendingMessage(), "World")
|
|
|
|
gobot.Assert(t, d.PendingMessage(), "")
|
2014-06-13 14:18:57 -07:00
|
|
|
}
|