Skip to content

Commit

Permalink
Removed old test
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Fish committed Oct 21, 2019
1 parent 46aa733 commit b750477
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions tap_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package talon_access_proxy

import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
Expand All @@ -12,43 +10,6 @@ import (
"go.uber.org/zap"
)

func TestAPICallWithHMAC(t *testing.T) {
logger, err := zap.NewDevelopment()
require.NoError(t, err)
// from the https://developers.talon.one/docs/
tap, err := New(Config{
TalonAPI: "https://demo.talon.one",
Application: map[string]*ApplicationConfig{
"73": &ApplicationConfig{
CalculateHMAC: true,
ApplicationKey: "e3b620ed8144f292",
},
},
Logger: logger,
})
require.NoError(t, err)

server := httptest.NewServer(tap.Handler())

defer server.Close()

var buffer bytes.Buffer
require.NoError(t, json.NewEncoder(&buffer).Encode(map[string]interface{}{
"attributes": map[string]interface{}{
"Email": "[email protected]",
},
}))

req, err := http.NewRequest("PUT", server.URL+"/v1/customer_profiles/165f239c", &buffer)
require.NoError(t, err)
req.Header.Set("Content-Signature", "signer=73")
req.Header.Set("Content-Type", "application/json")
res, err := server.Client().Do(req)
require.NoError(t, err)
require.Equal(t, http.StatusOK, res.StatusCode)
require.Equal(t, Version, res.Header.Get("X-Tap"))
}

func BenchmarkTap(b *testing.B) {
server := httptest.NewServer(nil)
defer server.Close()
Expand Down

0 comments on commit b750477

Please sign in to comment.