mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-30 12:20:33 +00:00
fix unit tests
This commit is contained in:
parent
cb97b39c82
commit
7ab33f62f7
2 changed files with 5 additions and 5 deletions
|
@ -25,12 +25,12 @@ func TestSecret(t *testing.T) {
|
|||
g.Describe("Secret", func() {
|
||||
g.It("should match event", func() {
|
||||
secret := Secret{}
|
||||
secret.Events = []string{"pull_request"}
|
||||
secret.Events = []WebhookEvent{"pull_request"}
|
||||
g.Assert(secret.Match("pull_request")).IsTrue()
|
||||
})
|
||||
g.It("should not match event", func() {
|
||||
secret := Secret{}
|
||||
secret.Events = []string{"pull_request"}
|
||||
secret.Events = []WebhookEvent{"pull_request"}
|
||||
g.Assert(secret.Match("push")).IsFalse()
|
||||
})
|
||||
g.It("should match when no event filters defined", func() {
|
||||
|
|
|
@ -31,7 +31,7 @@ func TestSecretFind(t *testing.T) {
|
|||
Name: "password",
|
||||
Value: "correct-horse-battery-staple",
|
||||
Images: []string{"golang", "node"},
|
||||
Events: []string{"push", "tag"},
|
||||
Events: []model.WebhookEvent{"push", "tag"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: insert secret: %s", err)
|
||||
|
@ -52,10 +52,10 @@ func TestSecretFind(t *testing.T) {
|
|||
if got, want := secret.Value, "correct-horse-battery-staple"; got != want {
|
||||
t.Errorf("Want secret value %s, got %s", want, got)
|
||||
}
|
||||
if got, want := secret.Events[0], "push"; got != want {
|
||||
if got, want := secret.Events[0], model.EventPush; got != want {
|
||||
t.Errorf("Want secret event %s, got %s", want, got)
|
||||
}
|
||||
if got, want := secret.Events[1], "tag"; got != want {
|
||||
if got, want := secret.Events[1], model.EventTag; got != want {
|
||||
t.Errorf("Want secret event %s, got %s", want, got)
|
||||
}
|
||||
if got, want := secret.Images[0], "golang"; got != want {
|
||||
|
|
Loading…
Reference in a new issue