forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathv330_test.go
More file actions
31 lines (23 loc) · 731 Bytes
/
Copy pathv330_test.go
File metadata and controls
31 lines (23 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_26
import (
"testing"
"code.gitea.io/gitea/models/migrations/base"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_AddSecretSaltToTwoFactor(t *testing.T) {
type TwoFactor struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"UNIQUE"`
Secret string
}
x, deferrable := base.PrepareTestEnv(t, 0, new(TwoFactor))
defer deferrable()
require.NoError(t, AddSecretSaltToTwoFactor(x))
table := base.LoadTableSchemasMap(t, x)["two_factor"]
require.NotNil(t, table)
assert.NotNil(t, table.GetColumn("secret_salt"))
assert.NotNil(t, table.GetColumn("secret_algo"))
}