api: adding a gRPC call for listing passwords.
This commit is contained in:
@@ -5,6 +5,7 @@ package conformance
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -244,6 +245,12 @@ func testRefreshTokenCRUD(t *testing.T, s storage.Storage) {
|
||||
}
|
||||
}
|
||||
|
||||
type byEmail []storage.Password
|
||||
|
||||
func (n byEmail) Len() int { return len(n) }
|
||||
func (n byEmail) Less(i, j int) bool { return n[i].Email < n[j].Email }
|
||||
func (n byEmail) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
|
||||
|
||||
func testPasswordCRUD(t *testing.T, s storage.Storage) {
|
||||
// Use bcrypt.MinCost to keep the tests short.
|
||||
passwordHash, err := bcrypt.GenerateFromPassword([]byte("secret"), bcrypt.MinCost)
|
||||
@@ -294,6 +301,8 @@ func testPasswordCRUD(t *testing.T, s storage.Storage) {
|
||||
t.Errorf("list password: %v", err)
|
||||
return
|
||||
}
|
||||
sort.Sort(byEmail(want))
|
||||
sort.Sort(byEmail(passwords))
|
||||
if diff := pretty.Compare(want, passwords); diff != "" {
|
||||
t.Errorf("password list retrieved from storage did not match: %s", diff)
|
||||
}
|
||||
|
Reference in New Issue
Block a user