Added the ability to create a team with SSO services and added the ability to turn off email sign up.
Этот коммит содержится в:
@@ -150,3 +150,45 @@ func TestUserGetDisplayName(t *testing.T) {
|
||||
t.Fatal("Display name should be nickname")
|
||||
}
|
||||
}
|
||||
|
||||
var usernames = []struct {
|
||||
value string
|
||||
expected bool
|
||||
}{
|
||||
{"spin-punch", true},
|
||||
{"Spin-punch", false},
|
||||
{"spin punch-", false},
|
||||
{"spin_punch", true},
|
||||
{"spin", true},
|
||||
{"PUNCH", false},
|
||||
{"spin.punch", true},
|
||||
{"spin'punch", false},
|
||||
{"spin*punch", false},
|
||||
{"all", false},
|
||||
}
|
||||
|
||||
func TestValidUsername(t *testing.T) {
|
||||
for _, v := range usernames {
|
||||
if IsValidUsername(v.value) != v.expected {
|
||||
t.Errorf("expect %v as %v", v.value, v.expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanUsername(t *testing.T) {
|
||||
if CleanUsername("Spin-punch") != "spin-punch" {
|
||||
t.Fatal("didn't clean name properly")
|
||||
}
|
||||
if CleanUsername("PUNCH") != "punch" {
|
||||
t.Fatal("didn't clean name properly")
|
||||
}
|
||||
if CleanUsername("spin'punch") != "spin-punch" {
|
||||
t.Fatal("didn't clean name properly")
|
||||
}
|
||||
if CleanUsername("spin") != "spin" {
|
||||
t.Fatal("didn't clean name properly")
|
||||
}
|
||||
if len(CleanUsername("all")) != 27 {
|
||||
t.Fatal("didn't clean name properly")
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user