<commit_before>package jwt_test

import (
	"testing"

	"google.golang.org/grpc/metadata"

	stdjwt "github.com/dgrijalva/jwt-go"

	"github.com/briankassouf/kit/auth/jwt"
	"golang.org/x/net/context"
)

var (
	key       = "test_signing_key"
	method    = stdjwt.SigningMethodHS256
	claims    = stdjwt.MapClaims{"user": "go-kit"}
	signedKey = "<KEY>"
)

func TestSigner(t *testing.T) {
	e := func(ctx context.Context, i interface{}) (interface{}, error) { return ctx, nil }

	signer := jwt.NewSigner(key, method, claims)(e)
	ctx := context.Background()
	ctx1, err := signer(ctx, struct{}{})
	if err != nil {
		t.Fatalf("Signer returned error: %s", err)
	}

	md, ok := metadata.FromContext(ctx1.(context.Context))
	if !ok {
		t.Fatal("Could not retrieve metadata from context")
	}

	token, ok := md[jwt.JWTTokenContextKey]
	if !ok {
		t.Fatal("Token did not exist in context")
	}

	if token[0] != signedKey {<commit_msg>Update import paths for to go-kit in test files<commit_after>package jwt_test

import (
	"testing"

	"google.golang.org/grpc/metadata"

	stdjwt "github.com/dgrijalva/jwt-go"

	"github.com/go-kit/kit/auth/jwt"
	"golang.org/x/net/context"
)

var (
	key       = "test_signing_key"
	method    = stdjwt.SigningMethodHS256
	claims    = stdjwt.MapClaims{"user": "go-kit"}
	signedKey = "<KEY>"
)

func TestSigner(t *testing.T) {
	e := func(ctx context.Context, i interface{}) (interface{}, error) { return ctx, nil }

	signer := jwt.NewSigner(key, method, claims)(e)
	ctx := context.Background()
	ctx1, err := signer(ctx, struct{}{})
	if err != nil {
		t.Fatalf("Signer returned error: %s", err)
	}

	md, ok := metadata.FromContext(ctx1.(context.Context))
	if !ok {
		t.Fatal("Could not retrieve metadata from context")
	}

	token, ok := md[jwt.JWTTokenContextKey]
	if !ok {
		t.Fatal("Token did not exist in context")
	}

	if token[0] != signedKey {
{'fraction_non_alphanumeric': 0.16056034482758622, 'fraction_numerical': 0.00646551724137931, 'mean_word_length': 3.9785522788203753, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4197940', 'n_tokens_mistral': 748, 'n_tokens_neox': 713, 'n_words': 158}