memos/test/store/workspace_setting_test.go

31 lines
798 B
Go
Raw Normal View History

2023-04-03 09:53:36 +08:00
package teststore
import (
"context"
"testing"
"github.com/stretchr/testify/require"
storepb "github.com/usememos/memos/proto/gen/store"
2023-06-29 22:55:03 +08:00
"github.com/usememos/memos/store"
2023-04-03 09:53:36 +08:00
)
func TestWorkspaceSettingV1Store(t *testing.T) {
ctx := context.Background()
ts := NewTestingStore(ctx, t)
2024-04-17 08:56:52 +08:00
workspaceSetting, err := ts.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL,
2024-04-10 20:05:17 +08:00
Value: &storepb.WorkspaceSetting_GeneralSetting{
GeneralSetting: &storepb.WorkspaceGeneralSetting{
DisallowSignup: true,
},
},
})
require.NoError(t, err)
2024-04-17 08:56:52 +08:00
list, err := ts.ListWorkspaceSettings(ctx, &store.FindWorkspaceSetting{})
require.NoError(t, err)
require.Equal(t, 1, len(list))
require.Equal(t, workspaceSetting, list[0])
ts.Close()
}