removed ref to old package in tests

This commit is contained in:
Brad Rydzewski 2015-06-13 17:51:55 -07:00
parent 1f0c249c82
commit ed0cae98a2
4 changed files with 64 additions and 64 deletions

View file

@ -4,7 +4,7 @@ import (
"testing"
"github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/types"
)
func TestRepostore(t *testing.T) {
@ -25,7 +25,7 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Set a Repo", func() {
repo := common.Repo{
repo := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
@ -40,7 +40,7 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Add a Repo", func() {
repo := common.Repo{
repo := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
@ -51,7 +51,7 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Get a Repo by ID", func() {
repo := common.Repo{
repo := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
@ -66,7 +66,7 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Get a Repo by Name", func() {
repo := common.Repo{
repo := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
@ -81,20 +81,20 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Get a Repo List by User", func() {
repo1 := common.Repo{
repo1 := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
}
repo2 := common.Repo{
repo2 := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone-dart",
}
rs.AddRepo(&repo1)
rs.AddRepo(&repo2)
ss.AddStar(&common.User{ID: 1}, &repo1)
repos, err := rs.RepoList(&common.User{ID: 1})
ss.AddStar(&types.User{ID: 1}, &repo1)
repos, err := rs.RepoList(&types.User{ID: 1})
g.Assert(err == nil).IsTrue()
g.Assert(len(repos)).Equal(1)
g.Assert(repos[0].UserID).Equal(repo1.UserID)
@ -103,7 +103,7 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Delete a Repo", func() {
repo := common.Repo{
repo := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
@ -118,12 +118,12 @@ func TestRepostore(t *testing.T) {
})
g.It("Should Enforce Unique Repo Name", func() {
repo1 := common.Repo{
repo1 := types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
}
repo2 := common.Repo{
repo2 := types.Repo{
UserID: 2,
Owner: "bradrydzewski",
Name: "drone",

View file

@ -4,7 +4,7 @@ import (
"testing"
"github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/types"
)
func TestStarstore(t *testing.T) {
@ -22,15 +22,15 @@ func TestStarstore(t *testing.T) {
})
g.It("Should Add a Star", func() {
user := common.User{ID: 1}
repo := common.Repo{ID: 2}
user := types.User{ID: 1}
repo := types.Repo{ID: 2}
err := ss.AddStar(&user, &repo)
g.Assert(err == nil).IsTrue()
})
g.It("Should Get Starred", func() {
user := common.User{ID: 1}
repo := common.Repo{ID: 2}
user := types.User{ID: 1}
repo := types.Repo{ID: 2}
ss.AddStar(&user, &repo)
ok, err := ss.Starred(&user, &repo)
g.Assert(err == nil).IsTrue()
@ -38,16 +38,16 @@ func TestStarstore(t *testing.T) {
})
g.It("Should Not Get Starred", func() {
user := common.User{ID: 1}
repo := common.Repo{ID: 2}
user := types.User{ID: 1}
repo := types.Repo{ID: 2}
ok, err := ss.Starred(&user, &repo)
g.Assert(err != nil).IsTrue()
g.Assert(ok).IsFalse()
})
g.It("Should Del a Star", func() {
user := common.User{ID: 1}
repo := common.Repo{ID: 2}
user := types.User{ID: 1}
repo := types.Repo{ID: 2}
ss.AddStar(&user, &repo)
_, err1 := ss.Starred(&user, &repo)
err2 := ss.DelStar(&user, &repo)

View file

@ -5,7 +5,7 @@ import (
"time"
"github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/types"
)
func TestTokenstore(t *testing.T) {
@ -23,10 +23,10 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should Add a new Token", func() {
token := common.Token{
token := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
@ -36,10 +36,10 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should get a Token", func() {
token := common.Token{
token := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
@ -55,15 +55,15 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should Get a Token By Label", func() {
token := common.Token{
token := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
err1 := ts.AddToken(&token)
gettoken, err2 := ts.TokenLabel(&common.User{ID: 1}, "foo")
gettoken, err2 := ts.TokenLabel(&types.User{ID: 1}, "foo")
g.Assert(err1 == nil).IsTrue()
g.Assert(err2 == nil).IsTrue()
g.Assert(token.ID).Equal(gettoken.ID)
@ -74,17 +74,17 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should Enforce Unique Token Label", func() {
token1 := common.Token{
token1 := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
token2 := common.Token{
token2 := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
@ -95,31 +95,31 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should Get a User Token List", func() {
token1 := common.Token{
token1 := types.Token{
UserID: 1,
Label: "bar",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
token2 := common.Token{
token2 := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
token3 := common.Token{
token3 := types.Token{
UserID: 2,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}
ts.AddToken(&token1)
ts.AddToken(&token2)
ts.AddToken(&token3)
tokens, err := ts.TokenList(&common.User{ID: 1})
tokens, err := ts.TokenList(&types.User{ID: 1})
g.Assert(err == nil).IsTrue()
g.Assert(len(tokens)).Equal(2)
g.Assert(tokens[0].ID).Equal(token1.ID)
@ -130,10 +130,10 @@ func TestTokenstore(t *testing.T) {
})
g.It("Should Del a Token", func() {
token := common.Token{
token := types.Token{
UserID: 1,
Label: "foo",
Kind: common.TokenUser,
Kind: types.TokenUser,
Issued: time.Now().Unix(),
Expiry: time.Now().Unix() + 1000,
}

View file

@ -4,7 +4,7 @@ import (
"testing"
"github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/types"
)
func TestUserstore(t *testing.T) {
@ -29,7 +29,7 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Update a User", func() {
user := common.User{
user := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -45,7 +45,7 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Add a new User", func() {
user := common.User{
user := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -57,7 +57,7 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Get a User", func() {
user := common.User{
user := types.User{
Login: "joe",
Token: "f0b461ca586c27872b43a0685cbc2847",
Secret: "976f22a5eef7caacb7e678d6c52f49b1",
@ -86,7 +86,7 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Get a User By Login", func() {
user := common.User{
user := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -100,13 +100,13 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Enforce Unique User Login", func() {
user1 := common.User{
user1 := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
Token: "e42080dddf012c718e476da161d21ad5",
}
user2 := common.User{
user2 := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -119,13 +119,13 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Get a User List", func() {
user1 := common.User{
user1 := types.User{
Login: "jane",
Name: "Jane Doe",
Email: "foo@bar.com",
Token: "ab20g0ddaf012c744e136da16aa21ad9",
}
user2 := common.User{
user2 := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -143,13 +143,13 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Get a User Count", func() {
user1 := common.User{
user1 := types.User{
Login: "jane",
Name: "Jane Doe",
Email: "foo@bar.com",
Token: "ab20g0ddaf012c744e136da16aa21ad9",
}
user2 := common.User{
user2 := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -169,7 +169,7 @@ func TestUserstore(t *testing.T) {
})
g.It("Should Del a User", func() {
user := common.User{
user := types.User{
Login: "joe",
Name: "Joe Sixpack",
Email: "foo@bar.com",
@ -185,41 +185,41 @@ func TestUserstore(t *testing.T) {
})
g.It("Should get the Build feed for a User", func() {
repo1 := &common.Repo{
repo1 := &types.Repo{
UserID: 1,
Owner: "bradrydzewski",
Name: "drone",
}
repo2 := &common.Repo{
repo2 := &types.Repo{
UserID: 2,
Owner: "drone",
Name: "drone",
}
rs.AddRepo(repo1)
rs.AddRepo(repo2)
ss.AddStar(&common.User{ID: 1}, repo1)
commit1 := &common.Commit{
ss.AddStar(&types.User{ID: 1}, repo1)
commit1 := &types.Commit{
RepoID: 1,
State: common.StateFailure,
State: types.StateFailure,
Ref: "refs/heads/master",
Sha: "85f8c029b902ed9400bc600bac301a0aadb144ac",
}
commit2 := &common.Commit{
commit2 := &types.Commit{
RepoID: 1,
State: common.StateSuccess,
State: types.StateSuccess,
Ref: "refs/heads/dev",
Sha: "85f8c029b902ed9400bc600bac301a0aadb144ac",
}
commit3 := &common.Commit{
commit3 := &types.Commit{
RepoID: 2,
State: common.StateSuccess,
State: types.StateSuccess,
Ref: "refs/heads/dev",
Sha: "85f8c029b902ed9400bc600bac301a0aadb144ac",
}
cs.AddCommit(commit1)
cs.AddCommit(commit2)
cs.AddCommit(commit3)
commits, err := us.UserFeed(&common.User{ID: 1}, 20, 0)
commits, err := us.UserFeed(&types.User{ID: 1}, 20, 0)
g.Assert(err == nil).IsTrue()
g.Assert(len(commits)).Equal(2)
g.Assert(commits[0].State).Equal(commit2.State)