aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-12 17:55:23 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-12 17:55:23 -0500
commitcc2f863c334691d4125563e0ee87bc191c190ed3 (patch)
tree3003afc16bb6571d5e47d4ffd45f180807beb7b7
parent0a8accca16c3231095be9d80e5496d039960ba62 (diff)
Renamed GetLight to GetLightByName and added unit tests.
-rw-r--r--light.go2
-rw-r--r--light_test.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/light.go b/light.go
index e3fe2a5..e2c7522 100644
--- a/light.go
+++ b/light.go
@@ -186,7 +186,7 @@ func GetLightByIndex(bridge *Bridge, index int) (Light, error) {
}
// GetLight will return a light struct containing data on a given name.
-func GetLight(bridge *Bridge, name string) (Light, error) {
+func GetLightByName(bridge *Bridge, name string) (Light, error) {
lights, _ := GetAllLights(bridge)
for _, light := range lights {
if light.Name == name {
diff --git a/light_test.go b/light_test.go
index 9073a06..da51dce 100644
--- a/light_test.go
+++ b/light_test.go
@@ -18,9 +18,9 @@ func TestGetAllLights(t *testing.T) {
GetAllLights(bridge)
}
-func TestGetLight(t *testing.T) {
+func TestGetLightByName(t *testing.T) {
bridge := NewBridge("192.168.1.128", "319b36233bd2328f3e40731b23479207")
- GetLight(bridge, "Bathroom Light")
+ GetLightByName(bridge, "Bathroom Light")
}
func TestSetLightState(t *testing.T) {