mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 16:42:36 +08:00
LDAP: nitpicks (#18309)
* LDAP: nitpicks * Add more tests * Correct and clarify comment for Login() method * Rename methods (hail consistency!) * Uppercases first letter of the logs everywhere * Moves method definitions around to more appropriate places Fixes #18295
This commit is contained in:
@ -182,7 +182,7 @@ func TestLDAPPrivateMethods(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
Convey("shouldAuthAdmin()", t, func() {
|
||||
Convey("shouldAdminBind()", t, func() {
|
||||
Convey("it should require admin userBind", func() {
|
||||
server := &Server{
|
||||
Config: &ServerConfig{
|
||||
@ -190,7 +190,7 @@ func TestLDAPPrivateMethods(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
result := server.shouldAuthAdmin()
|
||||
result := server.shouldAdminBind()
|
||||
So(result, ShouldBeTrue)
|
||||
})
|
||||
|
||||
@ -201,9 +201,46 @@ func TestLDAPPrivateMethods(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
result := server.shouldAuthAdmin()
|
||||
result := server.shouldAdminBind()
|
||||
So(result, ShouldBeFalse)
|
||||
})
|
||||
})
|
||||
|
||||
Convey("shouldSingleBind()", t, func() {
|
||||
Convey("it should allow single bind", func() {
|
||||
server := &Server{
|
||||
Config: &ServerConfig{
|
||||
BindDN: "cn=%s,dc=grafana,dc=org",
|
||||
},
|
||||
}
|
||||
|
||||
result := server.shouldSingleBind()
|
||||
So(result, ShouldBeTrue)
|
||||
})
|
||||
|
||||
Convey("it should not allow single bind", func() {
|
||||
server := &Server{
|
||||
Config: &ServerConfig{
|
||||
BindDN: "cn=admin,dc=grafana,dc=org",
|
||||
},
|
||||
}
|
||||
|
||||
result := server.shouldSingleBind()
|
||||
So(result, ShouldBeFalse)
|
||||
})
|
||||
})
|
||||
|
||||
Convey("singleBindDN()", t, func() {
|
||||
Convey("it should allow single bind", func() {
|
||||
server := &Server{
|
||||
Config: &ServerConfig{
|
||||
BindDN: "cn=%s,dc=grafana,dc=org",
|
||||
},
|
||||
}
|
||||
|
||||
result := server.singleBindDN("test")
|
||||
So(result, ShouldEqual, "cn=test,dc=grafana,dc=org")
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user