forked from makethunder/terraform-provider-fleet
/
nullapi_test.go
41 lines (30 loc) · 917 Bytes
/
nullapi_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
package main
import (
"testing"
"github.com/coreos/fleet/client"
)
func TestNullAPI(test *testing.T) {
var api client.API = new(nullAPI)
// all the methods return errors, all the time.
if _, err := api.Machines(); err == nil {
test.Error("Machines() did not return an error")
}
if _, err := api.Unit("foo"); err == nil {
test.Error("Unit() did not return an error")
}
if _, err := api.Units(); err == nil {
test.Error("Units() did not return an error")
}
if _, err := api.UnitStates(); err == nil {
test.Error("UnitStates() did not return an error")
}
if err := api.SetUnitTargetState("foo", "bar"); err == nil {
test.Error("SetUnitTargetState() did not return an error")
}
if err := api.CreateUnit(nil); err == nil {
test.Error("CreateUnit() did not return an error")
}
if err := api.DestroyUnit("foo"); err == nil {
test.Error("DestroyUnit() did not return an error")
}
}