-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathuser_test.go
39 lines (30 loc) · 946 Bytes
/
user_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
package imapsql
import (
"testing"
"gotest.tools/assert"
)
func TestUserCaseInsensitivity(t *testing.T) {
b := initTestBackend().(*Backend)
defer cleanBackend(b)
assert.NilError(t, b.CreateUser("foXcpp"))
_, err := b.Login(nil, "foXCpp", "")
assert.NilError(t, err, "b.Login")
u1, err := b.GetUser("Foxcpp")
assert.NilError(t, err, "b.GetUser")
u2, err := b.GetOrCreateUser("FOXcpp")
assert.NilError(t, err, "b.GetOrCreateUser")
assert.NilError(t, u1.CreateMailbox("BOX"))
_, mbox, err := u2.GetMailbox("BOX", true, &noopConn{})
assert.NilError(t, err, "u2.GetMailbox")
defer mbox.Close()
}
func TestInboxCreation(t *testing.T) {
b := initTestBackend().(*Backend)
defer cleanBackend(b)
assert.NilError(t, b.CreateUser("foxcpp"))
u, err := b.GetUser("foxcpp")
assert.NilError(t, err, "b.GetUser")
_, mbox, err := u.GetMailbox("INBOX", true, &noopConn{})
assert.NilError(t, err, "u.GetMailbox")
defer mbox.Close()
}