-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_user_test.go
More file actions
48 lines (41 loc) · 878 Bytes
/
Copy pathcreate_user_test.go
File metadata and controls
48 lines (41 loc) · 878 Bytes
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
package influxqb
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
var testCreateUser = []struct {
d string
b BuilderIf
s string
e bool
}{
{"Create User non Admin",
NewCreateUserBuilder().
WithUsername("UserName").
WithPassword("password!&é!$^ù"),
"CREATE USER UserName WITH PASSWORD 'password!&é!$^ù'",
false,
},
{"Create User Admin",
NewCreateUserBuilder().
WithUsername("UserName").
WithPassword("password!&é!$^ù").
Admin(),
"CREATE USER UserName WITH PASSWORD 'password!&é!$^ù' WITH ALL PRIVILEGES",
false,
},
}
func TestCreateUserBuilder(t *testing.T) {
for i, sample := range testCreateUser {
s, err := sample.b.Build()
fmt.Print("Test ", i, ": ", sample.d)
if sample.e {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
assert.Equal(t, sample.s, s)
fmt.Println(" [OK]")
}
}