Skip to content

Commit

Permalink
Make token a field in TestAuthAccessTokenSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoshuck committed Mar 8, 2024
1 parent 8c4bbcc commit c7640f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middleware/auth_access_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -30,6 +31,7 @@ func TestAuthFuncGRPC_AccessToken(t *testing.T) {

type TestAuthAccessTokenSuite struct {
*grpc_test.InterceptorTestSuite
token string
}

func (suite *TestAuthAccessTokenSuite) TestNoBearer() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c7640f9

Please sign in to comment.