File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "code.gitea.io/gitea/modules/timeutil"
1111
1212 "github.com/stretchr/testify/assert"
13+ "github.com/stretchr/testify/require"
1314 "xorm.io/xorm/schemas"
1415)
1516
@@ -56,10 +57,7 @@ func Test_RemigrateU2FCredentials(t *testing.T) {
5657 }
5758
5859 // Run the migration
59- if err := RemigrateU2FCredentials (x ); err != nil {
60- assert .NoError (t , err )
61- return
62- }
60+ require .NoError (t , RemigrateU2FCredentials (x ))
6361
6462 expected := []ExpectedWebauthnCredential {}
6563 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 {
2525func (f * fixturesLoader ) prepareFieldValue (v any ) any {
2626 if s , ok := v .(string ); ok {
2727 if strings .HasPrefix (s , "::HEX::" ) {
28- b , _ := hex .DecodeString (s [8 :])
28+ b , _ := hex .DecodeString (s [7 :])
2929 return b
3030 }
3131 }
3232 return v
3333}
34+
3435func (f * fixturesLoader ) loadFixtures (file string ) error {
3536 data , err := os .ReadFile (file )
3637 if err != nil {
@@ -51,10 +52,8 @@ func (f *fixturesLoader) loadFixtures(file string) error {
5152
5253 switch f .engine .Dialect ().URI ().DBType {
5354 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
5857 }
5958
6059 var sqlBuf []byte
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ func (*testItem2) Name() string {
3636}
3737
3838func TestAppStateDB (t * testing.T ) {
39- assert .NoError (t , unittest .PrepareTestDatabase ())
40-
4139 as := & DBStore {}
4240
4341 item1 := new (testItem1 )
You can’t perform that action at this time.
0 commit comments