auth
auth/memstore.go
Add more tests for ClientStores. Test that deleting a client that doesn't exist throws an ErrClientNotFound. Test that adding a client twice returns an ErrClientAlreadyExists. Test that clients retrieve have properties that all match the client that was stored. Remove the unused error return from the internal MemoryStore helper for getting a list of clients by their OwnerID. If a profile doesn't exist, return an empty list of clients, as we're technically returning any client that has that OwnerID. There's no guarantee that that OwnerID is actually valid.
1.1 --- a/memstore.go Sun Sep 07 04:15:04 2014 -0400 1.2 +++ b/memstore.go Sun Sep 07 04:34:17 2014 -0400 1.3 @@ -47,8 +47,12 @@ 1.4 return m.profileTokenLookup[id], nil 1.5 } 1.6 1.7 -func (m *Memstore) lookupClientsByProfileID(id string) ([]uuid.ID, error) { 1.8 +func (m *Memstore) lookupClientsByProfileID(id string) []uuid.ID { 1.9 m.clientLock.RLock() 1.10 defer m.clientLock.RUnlock() 1.11 - return m.profileClientLookup[id], nil 1.12 + c, ok := m.profileClientLookup[id] 1.13 + if !ok { 1.14 + return []uuid.ID{} 1.15 + } 1.16 + return c 1.17 }