28 строки
531 B
Go
28 строки
531 B
Go
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestIsUsernameTaken(t *testing.T) {
|
|
th := Setup().InitBasic()
|
|
user := th.BasicUser
|
|
taken := IsUsernameTaken(user.Username)
|
|
|
|
if !taken {
|
|
t.Logf("the username '%v' should be taken", user.Username)
|
|
t.FailNow()
|
|
}
|
|
|
|
newUsername := "randomUsername"
|
|
taken = IsUsernameTaken(newUsername)
|
|
|
|
if taken {
|
|
t.Logf("the username '%v' should not be taken", newUsername)
|
|
t.FailNow()
|
|
}
|
|
}
|