-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration_test.go
94 lines (76 loc) · 1.89 KB
/
configuration_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
88
89
90
91
92
93
94
package gremgoser
import (
"testing"
"time"
"github.com/intwinelabs/logger"
"github.com/stretchr/testify/assert"
)
func TestSetAuthentication(t *testing.T) {
assert := assert.New(t)
user := "foo"
pass := "bar"
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetAuthentication(user, pass)
_auth := &GremlinRequest{
RequestId: conf.AuthReq.RequestId,
Op: "authentication",
Processor: "traversal",
Args: map[string]interface{}{"sasl": "AGZvbwBiYXI="},
}
assert.Equal(_auth, conf.AuthReq)
}
func TestSetDebug(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetDebug()
assert.Equal(true, conf.Debug)
}
func TestSetVerbose(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetVerbose()
assert.Equal(true, conf.Verbose)
}
func TestSetTimeout(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetTimeout(22)
timeout := time.Duration(22000000000)
assert.Equal(timeout, conf.Timeout)
}
func TestSetPingInterval(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetPingInterval(22)
interval := time.Duration(22000000000)
assert.Equal(interval, conf.PingInterval)
}
func TestSetWritingWait(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetWritingWait(22)
wait := time.Duration(22000000000)
assert.Equal(wait, conf.WritingWait)
}
func TestSetReadingWait(t *testing.T) {
assert := assert.New(t)
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetReadingWait(22)
wait := time.Duration(22000000000)
assert.Equal(wait, conf.ReadingWait)
}
func TestSetLogger(t *testing.T) {
assert := assert.New(t)
log := logger.New()
u := "ws://127.0.0.1"
conf := NewClientConfig(u)
conf.SetLogger(log)
assert.Equal(log, conf.Logger)
}