This commit is contained in:
Misty Stanley-Jones 2016-09-28 14:25:04 -07:00
parent e9de6f2a44
commit d4f01b812c
31 changed files with 2000 additions and 0 deletions

View file

@ -0,0 +1,36 @@
package mocks
import "github.com/stretchr/testify/mock"
import "github.com/docker/distribution"
import "github.com/docker/distribution/context"
type ManifestStore struct {
mock.Mock
}
func (m *ManifestStore) GetManifest(ctx context.Context, key string) ([]byte, error) {
ret := m.Called(ctx, key)
var r0 []byte
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
r1 := ret.Error(1)
return r0, r1
}
func (m *ManifestStore) PutManifest(ctx context.Context, repo, digest string, val distribution.Manifest) error {
ret := m.Called(ctx, repo, digest, val)
r0 := ret.Error(0)
return r0
}
func (m *ManifestStore) DeleteManifest(ctx context.Context, key string) error {
ret := m.Called(ctx, key)
r0 := ret.Error(0)
return r0
}

View file

@ -0,0 +1,27 @@
package mocks
import (
"time"
"github.com/docker/dhe-deploy/manager/schema"
)
type Store struct {
*ManifestStore
*TagStore
}
func NewStore() *Store {
return &Store{
&ManifestStore{},
&TagStore{},
}
}
func (Store) CreateEvent(event *schema.Event) error { return nil }
func (Store) GetEvents(requestedPageEncoded string, perPage uint, publishedBefore, publishedAfter *time.Time, queryingUserId, actorId, eventType string, isAdmin bool) (events []schema.Event, nextPageEncoded string, err error) {
return []schema.Event{}, "", nil
}
func (Store) Subscribe(schema.EventReactor) chan bool {
return nil
}

View file

@ -0,0 +1,55 @@
package mocks
import "github.com/stretchr/testify/mock"
import "github.com/docker/distribution"
import "github.com/docker/distribution/context"
type TagStore struct {
mock.Mock
}
func (m *TagStore) GetTag(ctx context.Context, repo distribution.Repository, key string) (distribution.Descriptor, error) {
ret := m.Called(ctx, repo, key)
r0 := ret.Get(0).(distribution.Descriptor)
r1 := ret.Error(1)
return r0, r1
}
func (m *TagStore) PutTag(ctx context.Context, repo distribution.Repository, key string, val distribution.Descriptor) error {
ret := m.Called(ctx, repo, key, val)
r0 := ret.Error(0)
return r0
}
func (m *TagStore) DeleteTag(ctx context.Context, repo distribution.Repository, key string) error {
ret := m.Called(ctx, repo, key)
r0 := ret.Error(0)
return r0
}
func (m *TagStore) AllTags(ctx context.Context, repo distribution.Repository) ([]string, error) {
ret := m.Called(ctx, repo)
var r0 []string
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
r1 := ret.Error(1)
return r0, r1
}
func (m *TagStore) LookupTags(ctx context.Context, repo distribution.Repository, digest distribution.Descriptor) ([]string, error) {
ret := m.Called(ctx, repo, digest)
var r0 []string
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
r1 := ret.Error(1)
return r0, r1
}