From 7ab33f62f77d5c6d497bcadd0aca87593c148ea9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 11 Dec 2021 02:41:28 +0100 Subject: [PATCH] fix unit tests --- server/model/secret_test.go | 4 ++-- server/store/datastore/secret_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/model/secret_test.go b/server/model/secret_test.go index 259b35250..58dc8fea4 100644 --- a/server/model/secret_test.go +++ b/server/model/secret_test.go @@ -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() { diff --git a/server/store/datastore/secret_test.go b/server/store/datastore/secret_test.go index 4b0887888..0285a13cd 100644 --- a/server/store/datastore/secret_test.go +++ b/server/store/datastore/secret_test.go @@ -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 {