mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-06-05 17:08:50 +00:00
add test in secret validation
This commit is contained in:
parent
8c91205042
commit
98a984a003
1 changed files with 19 additions and 3 deletions
|
@ -25,10 +25,26 @@ func TestSecret(t *testing.T) {
|
||||||
secret := Secret{}
|
secret := Secret{}
|
||||||
g.Assert(secret.Match("pull_request")).IsTrue()
|
g.Assert(secret.Match("pull_request")).IsTrue()
|
||||||
})
|
})
|
||||||
g.It("should pass validation")
|
g.It("should pass validation", func() {
|
||||||
|
secret := Secret{}
|
||||||
|
secret.Name = "secretname"
|
||||||
|
secret.Value = "secretvalue"
|
||||||
|
err := secret.Validate()
|
||||||
|
g.Assert(err).Equal(nil)
|
||||||
|
})
|
||||||
g.Describe("should fail validation", func() {
|
g.Describe("should fail validation", func() {
|
||||||
g.It("when no image")
|
g.It("when no name", func() {
|
||||||
g.It("when no event")
|
secret := Secret{}
|
||||||
|
secret.Value = "secretvalue"
|
||||||
|
err := secret.Validate()
|
||||||
|
g.Assert(err != nil).IsTrue()
|
||||||
|
})
|
||||||
|
g.It("when no value", func() {
|
||||||
|
secret := Secret{}
|
||||||
|
secret.Name = "secretname"
|
||||||
|
err := secret.Validate()
|
||||||
|
g.Assert(err != nil).IsTrue()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue