From 5a9be3d516011490cdb57fc37c15c448487565db Mon Sep 17 00:00:00 2001 From: nxshock Date: Wed, 31 Jul 2019 20:13:52 +0500 Subject: [PATCH] Add LogoutAll() test --- internal/backends/memory/user_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/backends/memory/user_test.go b/internal/backends/memory/user_test.go index a3d3507..8c7e7c5 100644 --- a/internal/backends/memory/user_test.go +++ b/internal/backends/memory/user_test.go @@ -172,3 +172,24 @@ func TestSetRoomVisibility(t *testing.T) { assert.NotNil(t, err) assert.NotEqual(t, createroom.VisibilityTypePrivate, room.Visibility()) } + +func TestLogoutAll(t *testing.T) { + backend := NewBackend("localhost") + + var ( + userName = "user1" + password = "password1" + ) + + user, _, err := backend.Register(userName, password, "dev1") + assert.Nil(t, err) + assert.Len(t, user.Devices(), 1) + + _, err = backend.Login(userName, password, "dev2") + assert.Nil(t, err) + assert.Len(t, user.Devices(), 2) + + user.LogoutAll() + + assert.Len(t, user.Devices(), 0) +}