Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
agent/backend: update tests with app name
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio-Guerra committed Jan 23, 2019
1 parent 65fecac commit 440c677
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions agent/backend/client_test.go
Expand Up @@ -31,6 +31,7 @@ func TestClient(t *testing.T) {

t.Run("AppLogin", func(t *testing.T) {
token := testlib.RandString(2, 50)
appName := testlib.RandString(2, 50)

statusCode := http.StatusOK

Expand All @@ -45,7 +46,8 @@ func TestClient(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())

headers := http.Header{
config.BackendHTTPAPIHeaderToken: []string{token},
config.BackendHTTPAPIHeaderToken: []string{token},
config.BackendHTTPAPIHeaderAppName: []string{appName},
}

server := initFakeServer(endpointCfg, request, response, statusCode, headers)
Expand All @@ -54,7 +56,7 @@ func TestClient(t *testing.T) {
client, err := backend.NewClient(server.URL())
g.Expect(err).NotTo(HaveOccurred())

res, err := client.AppLogin(request, token)
res, err := client.AppLogin(request, token, appName)
g.Expect(err).NotTo(HaveOccurred())
// A request has been received
g.Expect(len(server.ReceivedRequests())).ToNot(Equal(0))
Expand Down Expand Up @@ -267,7 +269,7 @@ func testProxy(t *testing.T, envVar string) {
require.Equal(t, err, nil)
// Perform a request that should go through the proxy.
request := api.NewPopulatedAppLoginRequest(popr, false)
_, err = client.AppLogin(request, "my-token")
_, err = client.AppLogin(request, "my-token", "my-app")
// A request has been received:
//require.NotEqual(t, len(back.ReceivedRequests()), 0, "0 request received")
require.NotEqual(t, len(proxy.ReceivedRequests()), 0, "0 request received")
Expand Down

0 comments on commit 440c677

Please sign in to comment.