From ba6e370ca71abacaa30234cb164427d27c86df13 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 21 Dec 2016 16:35:01 -0500 Subject: PLT-5012 Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API (#4840) * Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API * Remove preference DB writes --- api/deprecated_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'api/deprecated_test.go') diff --git a/api/deprecated_test.go b/api/deprecated_test.go index 000b3950d..ee2ce0b2c 100644 --- a/api/deprecated_test.go +++ b/api/deprecated_test.go @@ -41,3 +41,44 @@ func TestGetMoreChannel(t *testing.T) { t.Fatal("cache should be empty") } } + +/* +func TestSetActiveChannel(t *testing.T) { + th := Setup().InitBasic() + Client := th.BasicClient + + if _, err := Client.SetActiveChannel(th.BasicChannel.Id); err != nil { + t.Fatal(err) + } + + status, _ := GetStatus(th.BasicUser.Id) + if status.ActiveChannel != th.BasicChannel.Id { + t.Fatal("active channel should be set") + } + + if _, err := Client.SetActiveChannel(""); err != nil { + t.Fatal(err) + } + + status, _ = GetStatus(th.BasicUser.Id) + if status.ActiveChannel != "" { + t.Fatal("active channel should be blank") + } + + if _, err := Client.SetActiveChannel("123456789012345678901234567890"); err == nil { + t.Fatal("should have failed, id too long") + } + + if _, err := Client.UpdateLastViewedAt(th.BasicChannel.Id, true); err != nil { + t.Fatal(err) + } + + time.Sleep(500 * time.Millisecond) + + status, _ = GetStatus(th.BasicUser.Id) + need to check if offline to catch race + if status.Status != model.STATUS_OFFLINE && status.ActiveChannel != th.BasicChannel.Id { + t.Fatal("active channel should be set") + } +} +*/ -- cgit v1.2.3-1-g7c22