mirror of
https://github.com/usememos/memos.git
synced 2024-11-16 03:34:33 +08:00
66e65e4dc1
* refactor: user api v1 * refactor: system setting to apiv1 * chore: remove unused definition * chore: update * chore: refactor: system setting * chore: update * refactor: migrate tag * feat: migrate activity store * refactor: migrate shortcut apiv1 * chore: update
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package teststore
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
apiv1 "github.com/usememos/memos/api/v1"
|
|
"github.com/usememos/memos/store"
|
|
)
|
|
|
|
func TestSystemSettingStore(t *testing.T) {
|
|
ctx := context.Background()
|
|
ts := NewTestingStore(ctx, t)
|
|
_, err := ts.UpsertSystemSetting(ctx, &store.SystemSetting{
|
|
Name: apiv1.SystemSettingServerIDName.String(),
|
|
Value: "test_server_id",
|
|
})
|
|
require.NoError(t, err)
|
|
_, err = ts.UpsertSystemSetting(ctx, &store.SystemSetting{
|
|
Name: apiv1.SystemSettingSecretSessionName.String(),
|
|
Value: "test_secret_session_name",
|
|
})
|
|
require.NoError(t, err)
|
|
_, err = ts.UpsertSystemSetting(ctx, &store.SystemSetting{
|
|
Name: apiv1.SystemSettingAllowSignUpName.String(),
|
|
Value: "true",
|
|
})
|
|
require.NoError(t, err)
|
|
_, err = ts.UpsertSystemSetting(ctx, &store.SystemSetting{
|
|
Name: apiv1.SystemSettingLocalStoragePathName.String(),
|
|
Value: "/tmp/memos",
|
|
})
|
|
require.NoError(t, err)
|
|
list, err := ts.ListSystemSettings(ctx, &store.FindSystemSetting{})
|
|
require.NoError(t, err)
|
|
require.Equal(t, 4, len(list))
|
|
}
|