1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-22 05:09:42 +02:00
authboss/mocks_test.go
Aaron 89875f7b68 Clean up mocks.
- Add CurrentUser method.
2015-01-17 02:42:42 -08:00

34 lines
742 B
Go

package authboss
type mockUser struct {
Email string
Password string
}
type mockStorer map[string]Attributes
func (m mockStorer) Create(key string, attr Attributes) error {
m[key] = attr
return nil
}
func (m mockStorer) Put(key string, attr Attributes) error {
m[key] = attr
return nil
}
func (m mockStorer) Get(key string, attrMeta AttributeMeta) (result interface{}, err error) {
return &mockUser{
m[key]["email"].(string), m[key]["password"].(string),
}, nil
}
type mockClientStore map[string]string
func (m mockClientStore) Get(key string) (string, bool) {
v, ok := m[key]
return v, ok
}
func (m mockClientStore) Put(key, val string) { m[key] = val }
func (m mockClientStore) Del(key string) { delete(m, key) }