From 10e5b6f14804ef86a020f5bdf30cde540ab957a1 Mon Sep 17 00:00:00 2001 From: Nicholas Cristofaro Date: Tue, 23 Jan 2024 14:24:08 -0300 Subject: [PATCH] is: Add console_preferences to user_store tests --- pkg/identityserver/storetest/user_store.go | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/identityserver/storetest/user_store.go b/pkg/identityserver/storetest/user_store.go index 6e0136feb38..52410a9629a 100644 --- a/pkg/identityserver/storetest/user_store.go +++ b/pkg/identityserver/storetest/user_store.go @@ -72,6 +72,9 @@ func (st *StoreTest) TestUserStoreCRUD(t *T) { TemporaryPasswordCreatedAt: timestamppb.New(stamp), TemporaryPasswordExpiresAt: timestamppb.New(stamp.Add(time.Hour)), ProfilePicture: picture, + ConsolePreferences: &ttnpb.UserConsolePreferences{ + ConsoleTheme: ttnpb.ConsoleTheme_CONSOLE_THEME_LIGHT, + }, }) if a.So(err, should.BeNil) && a.So(created, should.NotBeNil) { @@ -91,6 +94,11 @@ func (st *StoreTest) TestUserStoreCRUD(t *T) { a.So(*ttnpb.StdTime(created.TemporaryPasswordCreatedAt), should.Equal, stamp) a.So(*ttnpb.StdTime(created.TemporaryPasswordExpiresAt), should.Equal, stamp.Add(time.Hour)) a.So(created.ProfilePicture, should.Resemble, picture) + a.So( + created.ConsolePreferences, + should.Resemble, + &ttnpb.UserConsolePreferences{ConsoleTheme: ttnpb.ConsoleTheme_CONSOLE_THEME_LIGHT}, + ) a.So(*ttnpb.StdTime(created.CreatedAt), should.HappenWithin, 5*time.Second, start) a.So(*ttnpb.StdTime(created.UpdatedAt), should.HappenWithin, 5*time.Second, start) } @@ -208,6 +216,12 @@ func (st *StoreTest) TestUserStoreCRUD(t *T) { TemporaryPasswordCreatedAt: timestamppb.New(stamp), TemporaryPasswordExpiresAt: timestamppb.New(stamp.Add(time.Hour)), ProfilePicture: updatedPicture, + ConsolePreferences: &ttnpb.UserConsolePreferences{ + ConsoleTheme: ttnpb.ConsoleTheme_CONSOLE_THEME_DARK, + DashboardLayouts: &ttnpb.UserConsolePreferences_DashboardLayouts{ + ApiKey: ttnpb.DashboardLayout_DASHBOARD_LAYOUT_LIST, + }, + }, }, mask) if a.So(err, should.BeNil) && a.So(updated, should.NotBeNil) { a.So(updated.GetIds().GetUserId(), should.Equal, "foo") @@ -226,6 +240,16 @@ func (st *StoreTest) TestUserStoreCRUD(t *T) { a.So(*ttnpb.StdTime(updated.TemporaryPasswordCreatedAt), should.Equal, stamp) a.So(*ttnpb.StdTime(updated.TemporaryPasswordExpiresAt), should.Equal, stamp.Add(time.Hour)) a.So(updated.ProfilePicture, should.Resemble, updatedPicture) + a.So( + updated.ConsolePreferences, + should.Resemble, + &ttnpb.UserConsolePreferences{ + ConsoleTheme: ttnpb.ConsoleTheme_CONSOLE_THEME_DARK, + DashboardLayouts: &ttnpb.UserConsolePreferences_DashboardLayouts{ + ApiKey: ttnpb.DashboardLayout_DASHBOARD_LAYOUT_LIST, + }, + }, + ) a.So(*ttnpb.StdTime(updated.CreatedAt), should.Equal, *ttnpb.StdTime(created.CreatedAt)) a.So(*ttnpb.StdTime(updated.UpdatedAt), should.HappenWithin, 5*time.Second, start) }