github.com/amimof/huego@v1.2.1/capabilities_test.go (about)

     1  package huego
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestGetCapabilities(t *testing.T) {
     8  	b := New(hostname, username)
     9  	c, err := b.GetCapabilities()
    10  	if err != nil {
    11  		t.Fatal(c)
    12  	}
    13  	t.Log("Capabilities:")
    14  	t.Log("  Groups")
    15  	t.Logf("    Available: %d", c.Groups.Available)
    16  	t.Log("  Lights")
    17  	t.Logf("    Available: %d", c.Lights.Available)
    18  	t.Log("  Resourcelinks")
    19  	t.Logf("    Available: %d", c.Resourcelinks.Available)
    20  	t.Log("  Schedules")
    21  	t.Logf("    Available: %d", c.Schedules.Available)
    22  	t.Log("  Rules")
    23  	t.Logf("    Available: %d", c.Rules.Available)
    24  	t.Log("  Scenes")
    25  	t.Logf("    Available: %d", c.Scenes.Available)
    26  	t.Log("  Sensors")
    27  	t.Logf("    Available: %d", c.Sensors.Available)
    28  	t.Log("  Streaming")
    29  	t.Logf("    Available: %d", c.Streaming.Available)
    30  }
    31  
    32  func TestGetCapabilitiesError(t *testing.T) {
    33  	b := New(badHostname, username)
    34  	_, err := b.GetCapabilities()
    35  	if err == nil {
    36  		t.Fatal("Expected error not to be nil")
    37  	}
    38  }