From b27c5373741a74ce26cc7fe7f4364fd5373d22ec Mon Sep 17 00:00:00 2001 From: nxshock Date: Wed, 24 Jul 2019 19:36:47 +0500 Subject: [PATCH] Move user test --- internal/backends/memory/backend_test.go | 18 ------------------ internal/backends/memory/user_test.go | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/backends/memory/backend_test.go b/internal/backends/memory/backend_test.go index e2adfb5..0b4d17c 100644 --- a/internal/backends/memory/backend_test.go +++ b/internal/backends/memory/backend_test.go @@ -87,21 +87,3 @@ func TestLogout(t *testing.T) { 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") -} diff --git a/internal/backends/memory/user_test.go b/internal/backends/memory/user_test.go index adde353..5db6e01 100644 --- a/internal/backends/memory/user_test.go +++ b/internal/backends/memory/user_test.go @@ -80,3 +80,21 @@ func TestGetUserByWrongToken(t *testing.T) { gotUser := backend.GetUserByToken("wrong token") 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") +}