2023-04-03 09:53:36 +08:00
|
|
|
package teststore
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2024-02-20 23:02:01 +08:00
|
|
|
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
|
|
|
)
|
|
|
|
|
2024-02-20 23:02:01 +08:00
|
|
|
func TestWorkspaceSettingV1Store(t *testing.T) {
|
|
|
|
ctx := context.Background()
|
|
|
|
ts := NewTestingStore(ctx, t)
|
|
|
|
workspaceSetting, err := ts.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{
|
|
|
|
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL,
|
|
|
|
Value: &storepb.WorkspaceSetting_General{
|
|
|
|
General: &storepb.WorkspaceGeneralSetting{
|
|
|
|
DisallowSignup: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
list, err := ts.ListWorkspaceSettingsV1(ctx, &store.FindWorkspaceSettingV1{})
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, 1, len(list))
|
|
|
|
require.Equal(t, workspaceSetting, list[0])
|
|
|
|
ts.Close()
|
|
|
|
}
|