diff --git a/mocks_test.go b/mocks_test.go index 0bc917b..2647251 100644 --- a/mocks_test.go +++ b/mocks_test.go @@ -1,6 +1,8 @@ package authboss import ( + "context" + "errors" "net/http" "net/url" "strings" @@ -18,20 +20,18 @@ type mockStoredUser struct { type mockStoreLoader map[string]mockUser -func (m mockStorer) Create(key string, attr Attributes) error { - m[key] = attr +func (m mockStoredUser) PutEmail(ctx context.Context, key string, email string) error { + m.Email = email return nil } -func (m mockStorer) Put(key string, attr Attributes) error { - m[key] = attr - return nil +func (m mockStoredUser) PutUsername(ctx context.Context, key string, username string) error { + return errors.New("not impl") } -func (m mockStorer) Get(key string) (result interface{}, err error) { - return &mockUser{ - m[key]["email"].(string), m[key]["password"].(string), - }, nil +func (m mockStoredUser) PutPassword(ctx context.Context, key string, password string) error { + m.Password = password + return nil } func (m mockStorer) PutOAuth(uid, provider string, attr Attributes) error { diff --git a/storer.go b/storer.go index 3e56a61..411eb47 100644 --- a/storer.go +++ b/storer.go @@ -53,11 +53,7 @@ type Storer interface { GetUsername(ctx context.Context) (username string, err error) GetPassword(ctx context.Context) (password string, err error) - // Create the user with the state, this should throw errors if - // it's created already. - Create(ctx context.Context) error - - // Save the state + // Save the state. Save(ctx context.Context) error // Load the state based on the properties that have been given (typically