Move user test

This commit is contained in:
nxshock 2019-07-24 19:36:47 +05:00
parent f0d2ea7f17
commit b27c537374
2 changed files with 18 additions and 18 deletions

View File

@ -87,21 +87,3 @@ func TestLogout(t *testing.T) {
user.Logout(token) user.Logout(token)
} }
func TestLogoutWithWrongToken(t *testing.T) {
backend := NewBackend("localhost")
var (
userName = "user1"
password = "password1"
)
user, _, err := backend.Register(userName, password, "")
assert.Nil(t, err)
token, err := backend.Login(userName, password, "")
assert.Nil(t, err)
assert.NotZero(t, token)
user.Logout("worng token")
}

View File

@ -80,3 +80,21 @@ func TestGetUserByWrongToken(t *testing.T) {
gotUser := backend.GetUserByToken("wrong token") gotUser := backend.GetUserByToken("wrong token")
assert.Nil(t, gotUser) assert.Nil(t, gotUser)
} }
func TestLogoutWithWrongToken(t *testing.T) {
backend := NewBackend("localhost")
var (
userName = "user1"
password = "password1"
)
user, _, err := backend.Register(userName, password, "")
assert.Nil(t, err)
token, err := backend.Login(userName, password, "")
assert.Nil(t, err)
assert.NotZero(t, token)
user.Logout("worng token")
}