mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-20 21:01:17 +00:00
115182e445
* Define configuration for LDAP module * Implement LDAP auth * Vendor new dependencies * Add documentation for LDAP provider
31 lines
722 B
Go
31 lines
722 B
Go
package ldap
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
// TestNewEntry tests that repeated calls to NewEntry return the same value with the same input
|
|
func TestNewEntry(t *testing.T) {
|
|
dn := "testDN"
|
|
attributes := map[string][]string{
|
|
"alpha": {"value"},
|
|
"beta": {"value"},
|
|
"gamma": {"value"},
|
|
"delta": {"value"},
|
|
"epsilon": {"value"},
|
|
}
|
|
executedEntry := NewEntry(dn, attributes)
|
|
|
|
iteration := 0
|
|
for {
|
|
if iteration == 100 {
|
|
break
|
|
}
|
|
testEntry := NewEntry(dn, attributes)
|
|
if !reflect.DeepEqual(executedEntry, testEntry) {
|
|
t.Fatalf("subsequent calls to NewEntry did not yield the same result:\n\texpected:\n\t%s\n\tgot:\n\t%s\n", executedEntry, testEntry)
|
|
}
|
|
iteration = iteration + 1
|
|
}
|
|
}
|