forked from civo/civogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisk_image_test.go
71 lines (54 loc) · 1.4 KB
/
disk_image_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
67
68
69
70
71
package civogo
import (
"testing"
)
func TestClienterDiskImage(t *testing.T) {
var c Clienter
c, _ = NewClient("foo", "NYC1")
c, _ = NewFakeClient()
_, _ = c.ListDiskImages()
}
func TestListDiskImages(t *testing.T) {
client, _ := NewFakeClient()
results, err := client.ListDiskImages()
if err != nil {
t.Errorf("Request returned an error: %s", err)
return
}
if len(results) != 4 {
t.Errorf("Expected %+v, got %+v", 4, len(results))
return
}
}
func TestGetDiskImage(t *testing.T) {
client, _ := NewFakeClient()
results, err := client.GetDiskImage("b82168fe-66f6-4b38-a3b8-5283542d5475")
if err != nil {
t.Errorf("Request returned an error: %s", err)
return
}
if results.ID != "b82168fe-66f6-4b38-a3b8-5283542d5475" {
t.Errorf("Expected %+v, got %+v", "b82168fe-66f6-4b38-a3b8-5283542d5475", results.ID)
return
}
if results.Name != "centos-7" {
t.Errorf("Expected %+v, got %+v", "centos-7", results.Name)
return
}
}
func TestFindDiskImage(t *testing.T) {
client, _ := NewFakeClient()
results, err := client.FindDiskImage("debian-10")
if err != nil {
t.Errorf("Request returned an error: %s", err)
return
}
if results.ID != "b82168fe-66f6-4b38-a3b8-52835428965" {
t.Errorf("Expected %+v, got %+v", "b82168fe-66f6-4b38-a3b8-52835428965", results.ID)
return
}
if results.Name != "debian-10" {
t.Errorf("Expected %+v, got %+v", "debian-10", results.Name)
return
}
}