From eb51458168a3f6f62d57f753521e91aed42af151 Mon Sep 17 00:00:00 2001 From: davidvader Date: Mon, 28 Aug 2023 11:20:39 -0500 Subject: [PATCH] fix: set mocked gin request context manually --- internal/token/refresh_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/token/refresh_test.go b/internal/token/refresh_test.go index 53623f833..a74b11259 100644 --- a/internal/token/refresh_test.go +++ b/internal/token/refresh_test.go @@ -6,6 +6,7 @@ package token import ( "context" + "net/http" "net/http/httptest" "testing" "time" @@ -64,6 +65,8 @@ func TestTokenManager_Refresh(t *testing.T) { resp := httptest.NewRecorder() context, _ := gin.CreateTestContext(resp) context.Set("database", db) + req, _ := http.NewRequestWithContext(context, "", "", nil) + context.Request = req // run tests got, err := tm.Refresh(context, rt) @@ -123,6 +126,8 @@ func TestTokenManager_Refresh_Expired(t *testing.T) { resp := httptest.NewRecorder() context, _ := gin.CreateTestContext(resp) context.Set("database", db) + req, _ := http.NewRequestWithContext(context, "", "", nil) + context.Request = req // run tests _, err = tm.Refresh(context, rt)