mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 15:26:36 +08:00
test(response): fix AbortWithError router tests and oauth/bootstrap reliability
- Add middleware_test.go covering ErrorHandlerMiddleware and Abort helpers - Switch router test setups to testhelper.NewTestGinEngine for error JSON - Fix OAuth provider cache to use mock HTTP client and normalize issuer URLs - Add ResetInitRuntimeOnceForTest to make bootstrap tests hermetic under -count - Update admin/task test imports for upload/task package move
This commit is contained in:
@@ -13,6 +13,9 @@ import (
|
||||
)
|
||||
|
||||
func TestInitSyncsPushEventsOnce(t *testing.T) {
|
||||
ResetInitRuntimeOnceForTest()
|
||||
t.Cleanup(ResetInitRuntimeOnceForTest)
|
||||
|
||||
dbConn, _, cleanup := testhelper.SetupTestEnvironment(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -28,8 +31,8 @@ func TestInitSyncsPushEventsOnce(t *testing.T) {
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
Init(ctx, Options{})
|
||||
Init(ctx, Options{API: true}) // second Init must not duplicate events (initRuntimeOnce)
|
||||
Init(ctx, Options{API: true})
|
||||
Init(ctx, Options{}) // second Init must not duplicate events (initRuntimeOnce)
|
||||
|
||||
var count int64
|
||||
if err := dbConn.Model(&model.PushEvent{}).Count(&count).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user