1 parent
8d09a1ad49
commit
038f425f2d
7 files changed
+47
-17
No files matched your search
@@ -93,7 +93,6 @@ func TestNormalizeIdentifierKeepsLegacyAccountCompatibility(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestResolveIdentifierFallbackToConfiguredDomainUser(t *testing.T) {
|
||||
oldConfig := config.Instance
|
||||
oldDB := db.Instance
|
||||
@@ -106,6 +105,14 @@ func TestResolveIdentifierFallbackToConfiguredDomainUser(t *testing.T) {
|
||||
if err := db.Init(""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got, err := NormalizeProtocolIdentifier(" Bob@Solit.cn "); err != nil || got != "bob@solit.cn" {
|
||||
t.Fatalf("normalized protocol identifier = %q, err = %v", got, err)
|
||||
}
|
||||
for _, identifier := range []string{"bob", "bob@other.com"} {
|
||||
if _, err := NormalizeProtocolIdentifier(identifier); err == nil {
|
||||
t.Fatalf("protocol identifier %q was accepted", identifier)
|
||||
}
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if db.Instance != nil && db.Instance != oldDB {
|
||||
_ = db.Instance.Close()
|
||||
@@ -141,4 +148,4 @@ func TestResolveIdentifierFallbackToConfiguredDomainUser(t *testing.T) {
|
||||
if _, err := ResolveIdentifier("bob@other.com"); err == nil {
|
||||
t.Fatal("unconfigured domain must not be resolved")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user