First version of getAlbumList.view working.

- It still misses almost all type options
- Introduced "parent" in Child subresponse, as it was breaking DSub
This commit is contained in:
Deluan
2016-03-04 09:09:16 -05:00
parent 87e012f3bf
commit 9a246b5432
12 changed files with 239 additions and 48 deletions
+15 -5
View File
@@ -13,8 +13,10 @@ func CreateMockAlbumRepo() *MockAlbum {
type MockAlbum struct {
domain.AlbumRepository
data map[string]*domain.Album
err bool
data map[string]*domain.Album
all domain.Albums
err bool
Options domain.QueryOptions
}
func (m *MockAlbum) SetError(err bool) {
@@ -23,12 +25,12 @@ func (m *MockAlbum) SetError(err bool) {
func (m *MockAlbum) SetData(j string, size int) {
m.data = make(map[string]*domain.Album)
var l = make([]domain.Album, size)
err := json.Unmarshal([]byte(j), &l)
m.all = make(domain.Albums, size)
err := json.Unmarshal([]byte(j), &m.all)
if err != nil {
fmt.Println("ERROR: ", err)
}
for _, a := range l {
for _, a := range m.all {
m.data[a.Id] = &a
}
}
@@ -48,6 +50,14 @@ func (m *MockAlbum) Get(id string) (*domain.Album, error) {
return m.data[id], nil
}
func (m *MockAlbum) GetAll(qo domain.QueryOptions) (domain.Albums, error) {
m.Options = qo
if m.err {
return nil, errors.New("Error!")
}
return m.all, nil
}
func (m *MockAlbum) FindByArtist(artistId string) (domain.Albums, error) {
if m.err {
return nil, errors.New("Error!")