File tree 3 files changed +6
-11
lines changed 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"code.gitea.io/gitea/modules/timeutil"
11
11
12
12
"github.com/stretchr/testify/assert"
13
+ "github.com/stretchr/testify/require"
13
14
"xorm.io/xorm/schemas"
14
15
)
15
16
@@ -56,10 +57,7 @@ func Test_RemigrateU2FCredentials(t *testing.T) {
56
57
}
57
58
58
59
// Run the migration
59
- if err := RemigrateU2FCredentials (x ); err != nil {
60
- assert .NoError (t , err )
61
- return
62
- }
60
+ require .NoError (t , RemigrateU2FCredentials (x ))
63
61
64
62
expected := []ExpectedWebauthnCredential {}
65
63
if err := x .Table ("expected_webauthn_credential" ).Asc ("id" ).Find (& expected ); ! assert .NoError (t , err ) {
Original file line number Diff line number Diff line change @@ -25,12 +25,13 @@ type fixturesLoader struct {
25
25
func (f * fixturesLoader ) prepareFieldValue (v any ) any {
26
26
if s , ok := v .(string ); ok {
27
27
if strings .HasPrefix (s , "::HEX::" ) {
28
- b , _ := hex .DecodeString (s [8 :])
28
+ b , _ := hex .DecodeString (s [7 :])
29
29
return b
30
30
}
31
31
}
32
32
return v
33
33
}
34
+
34
35
func (f * fixturesLoader ) loadFixtures (file string ) error {
35
36
data , err := os .ReadFile (file )
36
37
if err != nil {
@@ -51,10 +52,8 @@ func (f *fixturesLoader) loadFixtures(file string) error {
51
52
52
53
switch f .engine .Dialect ().URI ().DBType {
53
54
case schemas .MSSQL :
54
- _ , _ = f .engine .Exec ("SET IDENTITY_INSERT [%s] ON" , tableName )
55
- defer func () {
56
- _ , _ = f .engine .Exec ("SET IDENTITY_INSERT [%s] OFF" , tableName )
57
- }()
55
+ _ , _ = f .engine .Exec (fmt .Sprintf ("SET IDENTITY_INSERT `%s` ON" , tableName ))
56
+ // we can't revert this behavior, because some tests also depends on this, for example: Test_UpdateBadgeColName
58
57
}
59
58
60
59
var sqlBuf []byte
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ func (*testItem2) Name() string {
36
36
}
37
37
38
38
func TestAppStateDB (t * testing.T ) {
39
- assert .NoError (t , unittest .PrepareTestDatabase ())
40
-
41
39
as := & DBStore {}
42
40
43
41
item1 := new (testItem1 )
You can’t perform that action at this time.
0 commit comments