-
Notifications
You must be signed in to change notification settings - Fork 13
/
space_test.go
87 lines (72 loc) · 2.06 KB
/
space_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package kibana
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_SpaceGet(t *testing.T) {
skipIfNotXpackSecurity(t)
client := DefaultTestKibanaClient()
spaceAPI := client.Space()
space, err := spaceAPI.GetByID("default")
assert.Nil(t, err)
assert.NotNil(t, space, "Space retrieved from get by id was null.")
}
func Test_SpacePostEmpty(t *testing.T) {
skipIfNotXpackSecurity(t)
client := DefaultTestKibanaClient()
spaceAPI := client.Space()
basicSpace := &Space{
Id: "empty",
Name: "empty",
}
err := spaceAPI.Create(basicSpace)
assert.Nil(t, err, "Error creating space")
}
func Test_SpacePostBasic(t *testing.T) {
skipIfNotXpackSecurity(t)
client := DefaultTestKibanaClient()
spaceAPI := client.Space()
basicSpace := &Space{
Id: "basic",
Name: "Blue team",
Description: "Team managing water",
Color: "#0000ff",
Initials: "BL",
DisabledFeatures: []string{"dev_tools"},
}
err := spaceAPI.Create(basicSpace)
assert.Nil(t, err, "Error creating space")
space, err := spaceAPI.GetByID("basic")
assert.Nil(t, err)
assert.NotNil(t, space, "Space retrieved from get by id was null.")
assert.Equal(t, space.DisabledFeatures[0], "dev_tools")
}
func Test_SpaceDeleteBasic(t *testing.T) {
skipIfNotXpackSecurity(t)
client := DefaultTestKibanaClient()
spaceAPI := client.Space()
basicSpace := &Space{
Id: "blue",
Name: "Blue team",
}
err := spaceAPI.Create(basicSpace)
assert.Nil(t, err, "Error creating space")
err = spaceAPI.Delete("blue")
assert.Nil(t, err, "Error deleting space")
}
func Test_SpaceUpdateBasic(t *testing.T) {
skipIfNotXpackSecurity(t)
client := DefaultTestKibanaClient()
spaceAPI := client.Space()
basicSpace := &Space{
Id: "blue",
Name: "Blue team",
}
err := spaceAPI.Create(basicSpace)
assert.Nil(t, err, "Error creating space")
basicSpace.Description = "The blue team is a nice team"
err = spaceAPI.Update(basicSpace)
assert.Nil(t, err, "Error updating space")
err = spaceAPI.Delete("blue")
assert.Nil(t, err, "Error deleting space")
}