.examples
.github
alerting
client
config
controller
core
docs
jsonpath
metrics
pattern
security
basic.go
basic_test.go
config.go
config_test.go
oidc.go
oidc_test.go
sessions.go
storage
test
util
vendor
watchdog
web
.dockerignore
.gitattributes
.gitignore
Dockerfile
LICENSE
Makefile
README.md
config.yaml
go.mod
go.sum
main.go
24 lines
646 B
Go
24 lines
646 B
Go
package security
|
|
|
|
import "testing"
|
|
|
|
func TestBasicConfig_IsValidUsingBcrypt(t *testing.T) {
|
|
basicConfig := &BasicConfig{
|
|
Username: "admin",
|
|
PasswordBcryptHashBase64Encoded: "JDJhJDA4JDFoRnpPY1hnaFl1OC9ISlFsa21VS09wOGlPU1ZOTDlHZG1qeTFvb3dIckRBUnlHUmNIRWlT",
|
|
}
|
|
if !basicConfig.isValid() {
|
|
t.Error("basicConfig should've been valid")
|
|
}
|
|
}
|
|
|
|
func TestBasicConfig_IsValidWhenPasswordIsInvalidUsingBcrypt(t *testing.T) {
|
|
basicConfig := &BasicConfig{
|
|
Username: "admin",
|
|
PasswordBcryptHashBase64Encoded: "",
|
|
}
|
|
if basicConfig.isValid() {
|
|
t.Error("basicConfig shouldn't have been valid")
|
|
}
|
|
}
|