-
Notifications
You must be signed in to change notification settings - Fork 24
/
light_test.go
66 lines (55 loc) · 1.07 KB
/
light_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package hue
import (
"fmt"
"testing"
)
func TestGetLightAttributes(t *testing.T) {
bridge := NewBridge(host, username)
lights, err := bridge.GetAllLights()
if err != nil {
t.Fail()
}
light := lights[0]
state, err := light.GetLightAttributes()
if err != nil {
t.Fail()
}
fmt.Printf("%+v\n", state)
}
func TestSetName(t *testing.T) {
bridge := NewBridge(host, username)
lights, err := bridge.GetAllLights()
if err != nil {
t.Fail()
}
light := lights[0]
state, err := light.SetName("Bedroom Light")
if err != nil {
t.Fail()
}
fmt.Printf("%+v\n", state)
}
func TestColorLoop(t *testing.T) {
bridge := NewBridge(host, username)
light, err := bridge.FindLightById("3")
if err != nil {
t.Fail()
}
_, err = light.ColorLoop()
if err != nil {
fmt.Printf("unable to start color loop => %s\n", err)
t.Fail()
}
}
func TestOn(t *testing.T) {
bridge := NewBridge(host, username)
light, err := bridge.FindLightById("3")
if err != nil {
t.Fail()
}
_, err = light.On()
if err != nil {
fmt.Printf("unable to start color loop => %s\n", err)
t.Fail()
}
}