<commit_before>package client

import (
	"testing"
	"strconv"
	"github.com/stretchr/testify/assert"	
)

func TestCredentials(t *testing.T){

	 assert := assert.New(t)

	credentials := &Credentials{
		ClientID          : "tester" ,
		AccessToken       : "<PASSWORD>",
	}

	var credentialsTests = []struct {
		method string
		url  string
		host string
		port int
		hdr  string
		now  int64
		perr error
		verr error
		key  string
		hash func() hash.Hash
		reply bool
	}
	{
		{
			hdr:  `Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"`,
			hash: sha1.New,
			method : "GET",
			url : "/resource/4?filter=a",
			host : "example.com",
			port : 8080,
			now: 1353788437,
			key : "<KEY>",
		},
	}

	request := &http.Request{
				Method:     credentialsTests.method,
				RequestURI: credentialsTests.url,
				Host:       credentialsTests.host + ":" + strconv.Itoa(credentialsTests.port),
				Header:     http.Header{"Authorization": {credentialsTests.hdr}},
			}

	credentials.SignRequest(request,credentialsTests.hash)
	auth, errors := credentials.newAuth(credentialsTests.method ,credentialsTests.url,credentialsTests.hash)
	assert.Nil(errors)
}<commit_msg>Added a test case for the credentials<commit_after>package client

import (
	"crypto/sha1"
	"hash"
	"net/http"
	"strconv"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestCredentials(t *testing.T) {

	assert := assert.New(t)

	credentials := &Credentials{
		ClientID:    "tester",
		AccessToken: "<PASSWORD>",
	}

	var credentialsTests = []struct {
		method string
		url    string
		host   string
		port   int
		hdr    string
		now    int64
		perr   error
		verr   error
		key    string
		hash   hash.Hash
		reply  bool
	}{

		{
			hdr:    `Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"`,
			hash:   sha1.New(),
			method: "POST",
			url:    "https://auth.taskcluster.net/v1/test-authenticate",
			host:   "example.com",
			port:   8080,
			now:    1353788437,
			key:    "<KEY>",
		},
	}

	request := &http.Request{
		Method:     credentialsTests[0].method,
		RequestURI: credentialsTests[0].url,
		Host:       credentialsTests[0].host + ":" + strconv.Itoa(credentialsTests[0].port),
		Header:     http.Header{"Authorization": {credentialsTests[0].hdr}},
	}
	if credentialsTests[0].hash != nil {
		panic(credentialsTests[0].hash)
	}
	credentials.SignRequest(request, credentialsTests[0].hash)
	auth, errors := credentials.newAuth(credentialsTests[0].method, credentialsTests[0].url, credentialsTests[0].hash)
	assert.Equal(nil, errors)
	assert.Equal(auth.RequestHeader(), `Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"`)
}
{'fraction_non_alphanumeric': 0.14714494875549047, 'fraction_numerical': 0.03843338213762811, 'mean_word_length': 3.6878216123499143, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '3277368', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1013, 'n_words': 186}