1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00
forgejo/modules/activitypub/user_settings_test.go
TheFox0x7 072dd9f8bc enable linter testifylint on v7 (#4572)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4572
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
2024-07-30 19:42:06 +00:00

30 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)
}