fix unit tests

This commit is contained in:
6543 2021-12-11 02:41:28 +01:00
parent cb97b39c82
commit 7ab33f62f7
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
2 changed files with 5 additions and 5 deletions

View file

@ -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() {

View file

@ -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 {