-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage/static.go: storage backend should not explicitly lower-case e…
…mail ids.
- Loading branch information
1 parent
e40c01e
commit fd4f57b
Showing
4 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,9 +108,10 @@ func TestStaticPasswords(t *testing.T) { | |
p1 := storage.Password{Email: "[email protected]", Username: "foo_secret"} | ||
p2 := storage.Password{Email: "[email protected]", Username: "bar_secret"} | ||
p3 := storage.Password{Email: "[email protected]", Username: "spam_secret"} | ||
p4 := storage.Password{Email: "[email protected]", Username: "Spam_secret"} | ||
|
||
backing.CreatePassword(p1) | ||
s := storage.WithStaticPasswords(backing, []storage.Password{p2}) | ||
s := storage.WithStaticPasswords(backing, []storage.Password{p2}, logger) | ||
|
||
tests := []struct { | ||
name string | ||
|
@@ -160,22 +161,39 @@ func TestStaticPasswords(t *testing.T) { | |
}, | ||
}, | ||
{ | ||
name: "list passwords", | ||
name: "create passwords", | ||
action: func() error { | ||
passwords, err := s.ListPasswords() | ||
if err := s.CreatePassword(p4); err != nil { | ||
return err | ||
} | ||
return s.CreatePassword(p3) | ||
}, | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "get password", | ||
action: func() error { | ||
p, err := s.GetPassword(p4.Email) | ||
if err != nil { | ||
return err | ||
} | ||
if n := len(passwords); n != 2 { | ||
return fmt.Errorf("expected 2 passwords got %d", n) | ||
if strings.Compare(p.Email, p4.Email) != 0 { | ||
return fmt.Errorf("expected %s passwords got %s", p4.Email, p.Email) | ||
} | ||
return nil | ||
}, | ||
}, | ||
{ | ||
name: "create password", | ||
name: "list passwords", | ||
action: func() error { | ||
return s.CreatePassword(p3) | ||
passwords, err := s.ListPasswords() | ||
if err != nil { | ||
return err | ||
} | ||
if n := len(passwords); n != 3 { | ||
return fmt.Errorf("expected 3 passwords got %d", n) | ||
} | ||
return nil | ||
}, | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters