diff --git a/pkg/server/badge_test.go b/pkg/server/badge_test.go index bdba0f5fb..5dc9c56f3 100644 --- a/pkg/server/badge_test.go +++ b/pkg/server/badge_test.go @@ -56,8 +56,8 @@ func TestBadges(t *testing.T) { ctx.Set("datastore", store) ctx.Set("repo", repo) - commit := &common.Commit{State: test.state} - store.On("CommitLast", repo, test.branch).Return(commit, test.err).Once() + commit := &common.Build{Status: test.state} + store.On("BuildLast", repo, test.branch).Return(commit, test.err).Once() GetBadge(ctx) g.Assert(rw.Code).Equal(200) @@ -77,10 +77,10 @@ func TestBadges(t *testing.T) { ctx.Set("datastore", store) ctx.Set("repo", repo) - commits := []*common.Commit{ - &common.Commit{State: test.state}, + commits := []*common.Build{ + &common.Build{Status: test.state}, } - store.On("CommitList", repo, mock.AnythingOfType("int"), mock.AnythingOfType("int")).Return(commits, test.err).Once() + store.On("BuildList", repo, mock.AnythingOfType("int"), mock.AnythingOfType("int")).Return(commits, test.err).Once() GetCC(ctx) // in an error scenario (ie no build exists) we should diff --git a/pkg/server/user_test.go b/pkg/server/user_test.go index 11ff28828..f57aaecb5 100644 --- a/pkg/server/user_test.go +++ b/pkg/server/user_test.go @@ -59,7 +59,7 @@ func TestUser(t *testing.T) { g.Assert(rw.Code).Equal(200) g.Assert(out.Login).Equal(user.Login) g.Assert(out.Email).Equal(in.Email) - g.Assert(out.Gravatar).Equal("7194e8d48fa1d2b689f99443b767316c") + g.Assert(out.Avatar).Equal("7194e8d48fa1d2b689f99443b767316c") }) g.It("should put, error", func() { diff --git a/pkg/store/mock/mock.go b/pkg/store/mock/mock.go index 8b9e3cfb6..b199d5066 100644 --- a/pkg/store/mock/mock.go +++ b/pkg/store/mock/mock.go @@ -4,52 +4,52 @@ import ( "io" "github.com/drone/drone/Godeps/_workspace/src/github.com/stretchr/testify/mock" - common "github.com/drone/drone/pkg/types" + "github.com/drone/drone/pkg/types" ) type Store struct { mock.Mock } -func (m *Store) User(id int64) (*common.User, error) { +func (m *Store) User(id int64) (*types.User, error) { ret := m.Called(id) - var r0 *common.User + var r0 *types.User if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.User) + r0 = ret.Get(0).(*types.User) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) UserLogin(_a0 string) (*common.User, error) { +func (m *Store) UserLogin(_a0 string) (*types.User, error) { ret := m.Called(_a0) - var r0 *common.User + var r0 *types.User if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.User) + r0 = ret.Get(0).(*types.User) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) UserList() ([]*common.User, error) { +func (m *Store) UserList() ([]*types.User, error) { ret := m.Called() - var r0 []*common.User + var r0 []*types.User if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.User) + r0 = ret.Get(0).([]*types.User) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) UserFeed(_a0 *common.User, _a1 int, _a2 int) ([]*common.RepoCommit, error) { +func (m *Store) UserFeed(_a0 *types.User, _a1 int, _a2 int) ([]*types.RepoCommit, error) { ret := m.Called(_a0, _a1, _a2) - var r0 []*common.RepoCommit + var r0 []*types.RepoCommit if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.RepoCommit) + r0 = ret.Get(0).([]*types.RepoCommit) } r1 := ret.Error(1) @@ -63,75 +63,75 @@ func (m *Store) UserCount() (int, error) { return r0, r1 } -func (m *Store) AddUser(_a0 *common.User) error { +func (m *Store) AddUser(_a0 *types.User) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) SetUser(_a0 *common.User) error { +func (m *Store) SetUser(_a0 *types.User) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) DelUser(_a0 *common.User) error { +func (m *Store) DelUser(_a0 *types.User) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) Token(_a0 int64) (*common.Token, error) { +func (m *Store) Token(_a0 int64) (*types.Token, error) { ret := m.Called(_a0) - var r0 *common.Token + var r0 *types.Token if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Token) + r0 = ret.Get(0).(*types.Token) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) TokenLabel(_a0 *common.User, _a1 string) (*common.Token, error) { +func (m *Store) TokenLabel(_a0 *types.User, _a1 string) (*types.Token, error) { ret := m.Called(_a0, _a1) - var r0 *common.Token + var r0 *types.Token if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Token) + r0 = ret.Get(0).(*types.Token) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) TokenList(_a0 *common.User) ([]*common.Token, error) { +func (m *Store) TokenList(_a0 *types.User) ([]*types.Token, error) { ret := m.Called(_a0) - var r0 []*common.Token + var r0 []*types.Token if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Token) + r0 = ret.Get(0).([]*types.Token) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) AddToken(_a0 *common.Token) error { +func (m *Store) AddToken(_a0 *types.Token) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) DelToken(_a0 *common.Token) error { +func (m *Store) DelToken(_a0 *types.Token) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) Starred(_a0 *common.User, _a1 *common.Repo) (bool, error) { +func (m *Store) Starred(_a0 *types.User, _a1 *types.Repo) (bool, error) { ret := m.Called(_a0, _a1) r0 := ret.Get(0).(bool) @@ -139,173 +139,173 @@ func (m *Store) Starred(_a0 *common.User, _a1 *common.Repo) (bool, error) { return r0, r1 } -func (m *Store) AddStar(_a0 *common.User, _a1 *common.Repo) error { +func (m *Store) AddStar(_a0 *types.User, _a1 *types.Repo) error { ret := m.Called(_a0, _a1) r0 := ret.Error(0) return r0 } -func (m *Store) DelStar(_a0 *common.User, _a1 *common.Repo) error { +func (m *Store) DelStar(_a0 *types.User, _a1 *types.Repo) error { ret := m.Called(_a0, _a1) r0 := ret.Error(0) return r0 } -func (m *Store) Repo(id int64) (*common.Repo, error) { +func (m *Store) Repo(id int64) (*types.Repo, error) { ret := m.Called(id) - var r0 *common.Repo + var r0 *types.Repo if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Repo) + r0 = ret.Get(0).(*types.Repo) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) RepoName(owner string, name string) (*common.Repo, error) { +func (m *Store) RepoName(owner string, name string) (*types.Repo, error) { ret := m.Called(owner, name) - var r0 *common.Repo + var r0 *types.Repo if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Repo) + r0 = ret.Get(0).(*types.Repo) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) RepoList(_a0 *common.User) ([]*common.Repo, error) { +func (m *Store) RepoList(_a0 *types.User) ([]*types.Repo, error) { ret := m.Called(_a0) - var r0 []*common.Repo + var r0 []*types.Repo if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Repo) + r0 = ret.Get(0).([]*types.Repo) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) AddRepo(_a0 *common.Repo) error { +func (m *Store) AddRepo(_a0 *types.Repo) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) SetRepo(_a0 *common.Repo) error { +func (m *Store) SetRepo(_a0 *types.Repo) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) DelRepo(_a0 *common.Repo) error { +func (m *Store) DelRepo(_a0 *types.Repo) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) Commit(_a0 int64) (*common.Commit, error) { +func (m *Store) Build(_a0 int64) (*types.Build, error) { ret := m.Called(_a0) - var r0 *common.Commit + var r0 *types.Build if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Commit) + r0 = ret.Get(0).(*types.Build) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) CommitSeq(_a0 *common.Repo, _a1 int) (*common.Commit, error) { +func (m *Store) BuildNumber(_a0 *types.Repo, _a1 int) (*types.Build, error) { ret := m.Called(_a0, _a1) - var r0 *common.Commit + var r0 *types.Build if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Commit) + r0 = ret.Get(0).(*types.Build) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) CommitLast(_a0 *common.Repo, _a1 string) (*common.Commit, error) { +func (m *Store) BuildLast(_a0 *types.Repo, _a1 string) (*types.Build, error) { ret := m.Called(_a0, _a1) - var r0 *common.Commit + var r0 *types.Build if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Commit) + r0 = ret.Get(0).(*types.Build) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) CommitList(_a0 *common.Repo, _a1 int, _a2 int) ([]*common.Commit, error) { +func (m *Store) BuildList(_a0 *types.Repo, _a1 int, _a2 int) ([]*types.Build, error) { ret := m.Called(_a0, _a1, _a2) - var r0 []*common.Commit + var r0 []*types.Build if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Commit) + r0 = ret.Get(0).([]*types.Build) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) AddCommit(_a0 *common.Commit) error { +func (m *Store) AddBuild(_a0 *types.Build) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) SetCommit(_a0 *common.Commit) error { +func (m *Store) SetBuild(_a0 *types.Build) error { ret := m.Called(_a0) r0 := ret.Error(0) return r0 } -func (m *Store) KillCommits() error { +func (m *Store) KillBuilds() error { ret := m.Called() r0 := ret.Error(0) return r0 } -func (m *Store) Build(_a0 int64) (*common.Build, error) { +func (m *Store) Job(_a0 int64) (*types.Job, error) { ret := m.Called(_a0) - var r0 *common.Build + var r0 *types.Job if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Build) + r0 = ret.Get(0).(*types.Job) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) BuildSeq(_a0 *common.Commit, _a1 int) (*common.Build, error) { +func (m *Store) JobNumber(_a0 *types.Build, _a1 int) (*types.Job, error) { ret := m.Called(_a0, _a1) - var r0 *common.Build + var r0 *types.Job if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Build) + r0 = ret.Get(0).(*types.Job) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) BuildList(_a0 *common.Commit) ([]*common.Build, error) { +func (m *Store) JobList(_a0 *types.Build) ([]*types.Job, error) { ret := m.Called(_a0) - var r0 []*common.Build + var r0 []*types.Job if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Build) + r0 = ret.Get(0).([]*types.Job) } r1 := ret.Error(1) return r0, r1 } -func (m *Store) SetBuild(_a0 *common.Build) error { +func (m *Store) SetJob(_a0 *types.Job) error { ret := m.Called(_a0) r0 := ret.Error(0) @@ -352,7 +352,7 @@ func (m *Store) DelBlob(path string) error { return r0 } -func (m *Store) Agent(_a0 *common.Commit) (string, error) { +func (m *Store) Agent(_a0 *types.Build) (string, error) { ret := m.Called(_a0) r0 := ret.Get(0).(string) @@ -360,7 +360,7 @@ func (m *Store) Agent(_a0 *common.Commit) (string, error) { return r0, r1 } -func (m *Store) SetAgent(_a0 *common.Commit, _a1 string) error { +func (m *Store) SetAgent(_a0 *types.Build, _a1 string) error { ret := m.Called(_a0, _a1) r0 := ret.Error(0)