-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsession_test.go
68 lines (54 loc) · 1.62 KB
/
session_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
package prekeyserver
import (
"time"
. "gopkg.in/check.v1"
)
func (s *GenericServerSuite) Test_realSession_save_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
}
now := time.Now()
se.save(nil, nil, 0x00000000, nil)
c.Assert(se.lastTouched.After(now), Equals, true)
}
func (s *GenericServerSuite) Test_realSession_instanceTag_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
}
now := time.Now()
se.instanceTag()
c.Assert(se.lastTouched.After(now), Equals, true)
}
func (s *GenericServerSuite) Test_realSession_clientProfile_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
}
now := time.Now()
se.clientProfile()
c.Assert(se.lastTouched.After(now), Equals, true)
}
func (s *GenericServerSuite) Test_realSession_pointI_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
}
now := time.Now()
se.pointI()
c.Assert(se.lastTouched.After(now), Equals, true)
}
func (s *GenericServerSuite) Test_realSession_keypairS_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
}
now := time.Now()
se.keypairS()
c.Assert(se.lastTouched.After(now), Equals, true)
}
func (s *GenericServerSuite) Test_realSession_macKey_willUpdateTouch(c *C) {
se := &realSession{
lastTouched: time.Now().Add(time.Duration(-11) * time.Minute),
storedMac: []byte{0x01},
}
now := time.Now()
se.macKey()
c.Assert(se.lastTouched.After(now), Equals, true)
}