workspace_setting_test.go 790 B

123456789101112131415161718192021222324252627282930
  1. package teststore
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/stretchr/testify/require"
  6. storepb "github.com/usememos/memos/proto/gen/store"
  7. "github.com/usememos/memos/store"
  8. )
  9. func TestWorkspaceSettingV1Store(t *testing.T) {
  10. ctx := context.Background()
  11. ts := NewTestingStore(ctx, t)
  12. workspaceSetting, err := ts.UpsertWorkspaceSettingV1(ctx, &storepb.WorkspaceSetting{
  13. Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL,
  14. Value: &storepb.WorkspaceSetting_General{
  15. General: &storepb.WorkspaceGeneralSetting{
  16. DisallowSignup: true,
  17. },
  18. },
  19. })
  20. require.NoError(t, err)
  21. list, err := ts.ListWorkspaceSettingsV1(ctx, &store.FindWorkspaceSettingV1{})
  22. require.NoError(t, err)
  23. require.Equal(t, 1, len(list))
  24. require.Equal(t, workspaceSetting, list[0])
  25. ts.Close()
  26. }