refining and adding tests

This commit is contained in:
Justin Angel 2022-01-31 07:18:50 -05:00
parent 310e7b15c7
commit 0c3fd16113
2 changed files with 48 additions and 15 deletions

View file

@ -63,3 +63,25 @@ func (s *Suite) ResetDB(c *check.C) {
}
app.db = db
}
// Enusre an error is returned when an invalid auth mode
// is supplied.
func (s *Suite) TestInvalidClientAuthMode(c *check.C){
app.cfg.TLSClientAuthMode = "invalid"
_, err := app.GetClientAuthMode()
c.Assert(err, check.NotNil)
}
// Ensure that all client auth modes return a nil error
func (s *Suite) TestAuthModes(c *check.C){
var modes = []string{"disabled", "relaxed", "enforced"}
for _, v := range modes {
app.cfg.TLSClientAuthMode = v
_, err := app.GetClientAuthMode()
c.Assert(err, check.IsNil)
}
}