Skip to content

Commit

Permalink
add test in secret validation
Browse files Browse the repository at this point in the history
  • Loading branch information
hokichaio committed Jul 12, 2017
1 parent 8c91205 commit 98a984a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions model/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,26 @@ func TestSecret(t *testing.T) {
secret := Secret{}
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.It("when no image")
g.It("when no event")
g.It("when no name", func() {
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()
})
})
})
}

0 comments on commit 98a984a

Please sign in to comment.