From c7640f9f985c4d9ccf7561323d357ca0dd72cb9c Mon Sep 17 00:00:00 2001 From: Marcos Huck Date: Fri, 8 Mar 2024 13:46:29 +0000 Subject: [PATCH] Make token a field in TestAuthAccessTokenSuite --- middleware/auth_access_token_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/middleware/auth_access_token_test.go b/middleware/auth_access_token_test.go index fe1ba8d..3f2506e 100644 --- a/middleware/auth_access_token_test.go +++ b/middleware/auth_access_token_test.go @@ -17,6 +17,7 @@ import ( func TestAuthFuncGRPC_AccessToken(t *testing.T) { var ss TestAuthAccessTokenSuite ss = TestAuthAccessTokenSuite{ + token: "ey.LfexACqSU5qgYgp9EXSdR4rtnD7BJ0oOCNi8BKIkZ4vt25jRxyu6AXAKVNrtItb1", InterceptorTestSuite: &grpc_test.InterceptorTestSuite{ TestService: newTestAuthenticationAccessToken(), ServerOpts: []grpc.ServerOption{ @@ -30,6 +31,7 @@ func TestAuthFuncGRPC_AccessToken(t *testing.T) { type TestAuthAccessTokenSuite struct { *grpc_test.InterceptorTestSuite + token string } func (suite *TestAuthAccessTokenSuite) TestNoBearer() { @@ -86,7 +88,7 @@ func (suite *TestAuthAccessTokenSuite) TestValidToken() { } func (suite *TestAuthAccessTokenSuite) validateAccessToken(ctx context.Context, token string) error { - if token != "ey.LfexACqSU5qgYgp9EXSdR4rtnD7BJ0oOCNi8BKIkZ4vt25jRxyu6AXAKVNrtItb1" { + if token != suite.token { return status.Error(codes.Unauthenticated, "Invalid access token") } return nil