-
Notifications
You must be signed in to change notification settings - Fork 4
/
store_test.go
50 lines (44 loc) · 1.26 KB
/
store_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
package passhash_test
import (
"context"
"testing"
)
import (
"github.com/dhui/passhash"
)
func TestDummyCredentialStoreStore(t *testing.T) {
store := passhash.DummyCredentialStore{}
credential := &passhash.Credential{}
if err := store.Store(credential); err != nil {
t.Error("Got error storing credential.", err)
}
}
func TestDummyCredentialStoreStoreContext(t *testing.T) {
store := passhash.DummyCredentialStore{}
credential := &passhash.Credential{}
if err := store.StoreContext(context.Background(), credential); err != nil {
t.Error("Got error storing credential.", err)
}
}
func TestDummyCredentialStoreLoad(t *testing.T) {
store := passhash.DummyCredentialStore{}
userID := passhash.UserID(0)
credential, err := store.Load(userID)
if err == nil {
t.Error("Got error loading credential.", err)
}
if credential != nil {
t.Error("DummyCredentialStore provided credential.", credential)
}
}
func TestDummyCredentialStoreLoadContext(t *testing.T) {
store := passhash.DummyCredentialStore{}
userID := passhash.UserID(0)
credential, err := store.LoadContext(context.Background(), userID)
if err == nil {
t.Error("Got error loading credential.", err)
}
if credential != nil {
t.Error("DummyCredentialStore provided credential.", credential)
}
}