go-rapi-client/client_test.go

45 lines
1.0 KiB
Go

package rapi
import (
"testing"
)
func TestClientInitialization(t *testing.T) {
NewClient("test", "test123", "ganeti.test", 5080, 2)
}
func TestClusterInfo(t *testing.T) {
c := NewClient("test", "test123", "ganeti.test", 5080, 2)
_, err := c.GetClusterInformation()
if err != nil {
t.Errorf("Got error requesting cluster info %s", err)
}
}
func TestGetNetworks(t *testing.T) {
c := NewClient("test", "test123", "ganeti.test", 5080, 2)
_, err := c.GetNetworks()
if err != nil {
t.Errorf("Got error requesting network list %s", err)
}
}
func TestGetNetworksBulk(t *testing.T) {
c := NewClient("test", "test123", "ganeti.test", 5080, 2)
_, err := c.GetNetworksBulk()
if err != nil {
t.Errorf("Got error requesting network list %s", err)
}
}
func TestGetNetworkInformation(t *testing.T) {
c := NewClient("test", "test123", "ganeti.test", 5080, 2)
n, err := c.GetNetworks()
if err != nil {
t.Errorf("Got error requesting network list %s", err)
}
if len(n) == 0 {
t.Errorf("No networks defined")
}
}