mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 01:44:24 +01:00
4de909747b
go-require lint is ignored for now Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
31 lines
927 B
Go
31 lines
927 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package activitypub
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/models/db"
|
|
"code.gitea.io/gitea/models/unittest"
|
|
user_model "code.gitea.io/gitea/models/user"
|
|
|
|
_ "code.gitea.io/gitea/models" // https://discourse.gitea.io/t/testfixtures-could-not-clean-table-access-no-such-table-access/4137/4
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestUserSettings(t *testing.T) {
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
|
pub, priv, err := GetKeyPair(db.DefaultContext, user1)
|
|
require.NoError(t, err)
|
|
pub1, err := GetPublicKey(db.DefaultContext, user1)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, pub, pub1)
|
|
priv1, err := GetPrivateKey(db.DefaultContext, user1)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, priv, priv1)
|
|
}
|