From 11a06fa94dc31bcfd7e29dd06f063c32214de9f8 Mon Sep 17 00:00:00 2001 From: kyy Date: Tue, 3 Mar 2026 14:51:41 +0900 Subject: [PATCH] =?UTF-8?q?AuditRepository=20=EC=9D=B8=ED=84=B0=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=B0=20mock=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/handler/common_test.go | 10 ++++++++++ backend/internal/middleware/audit_middleware_test.go | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/backend/internal/handler/common_test.go b/backend/internal/handler/common_test.go index 15a6277e..656749d5 100644 --- a/backend/internal/handler/common_test.go +++ b/backend/internal/handler/common_test.go @@ -7,6 +7,7 @@ import ( "encoding/json" "io" "net/http" + "time" ) // --- Mock IDP Provider --- @@ -101,6 +102,15 @@ func (m *mockAuditRepo) FindByUserAndEvents(ctx context.Context, userID string, } return results, nil } + +func (m *mockAuditRepo) CountFailuresSince(ctx context.Context, since time.Time, tenantID string) (int64, error) { + return 0, nil +} + +func (m *mockAuditRepo) CountActiveSessionsSince(ctx context.Context, since time.Time, tenantID string) (int64, error) { + return 0, nil +} + func (m *mockAuditRepo) Ping(ctx context.Context) error { return nil } // --- Mock Consent Repository --- diff --git a/backend/internal/middleware/audit_middleware_test.go b/backend/internal/middleware/audit_middleware_test.go index f764b7d1..66a0f57e 100644 --- a/backend/internal/middleware/audit_middleware_test.go +++ b/backend/internal/middleware/audit_middleware_test.go @@ -8,6 +8,7 @@ import ( "net/http/httptest" "strings" "testing" + "time" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" @@ -34,6 +35,14 @@ func (m *MockAuditRepository) FindByUserAndEvents(ctx context.Context, userID st return args.Get(0).([]domain.AuditLog), args.Error(1) } +func (m *MockAuditRepository) CountFailuresSince(ctx context.Context, since time.Time, tenantID string) (int64, error) { + return 0, nil +} + +func (m *MockAuditRepository) CountActiveSessionsSince(ctx context.Context, since time.Time, tenantID string) (int64, error) { + return 0, nil +} + func (m *MockAuditRepository) Ping(ctx context.Context) error { args := m.Called(ctx) return args.Error(0)