Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Sep 16, 2024
1 parent 3ba6d0f commit 9cebef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/rpaas/client/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (c *client) GetMetadata(ctx context.Context, instance string) (*types.Metad
}

pathName := fmt.Sprintf("/resources/%s/metadata", instance)
req, err := c.newRequest("GET", pathName, nil, instance)
req, err := c.newRequest("GET", pathName, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -55,7 +55,7 @@ func (c *client) SetMetadata(ctx context.Context, instance string, metadata *typ
body := bytes.NewReader(b)

pathName := fmt.Sprintf("/resources/%s/metadata", instance)
req, err := c.newRequest("POST", pathName, body, instance)
req, err := c.newRequest("POST", pathName, body)
if err != nil {
return err
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func (c *client) UnsetMetadata(ctx context.Context, instance string, metadata *t
body := bytes.NewReader(b)

pathName := fmt.Sprintf("/resources/%s/metadata", instance)
req, err := c.newRequest("DELETE", pathName, body, instance)
req, err := c.newRequest("DELETE", pathName, body)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/rpaas/client/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestClientThroughTsuru_GetMetadata(t *testing.T) {
instance: "my-instance",
handler: func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "GET")
assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI())
assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI())
assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization"))

metadata := types.Metadata{
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestClientThroughTsuru_SetMetadata(t *testing.T) {
instance: "my-instance",
handler: func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "POST")
assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI())
assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI())
assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization"))
assert.Equal(t, "application/json", r.Header.Get("Content-Type"))
assert.NotNil(t, r.Body)
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestClientThroughTsuru_UnsetMetadata(t *testing.T) {
instance: "my-instance",
handler: func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "DELETE")
assert.Equal(t, fmt.Sprintf("/services/%s/proxy/%s?callback=%s", FakeTsuruService, "my-instance", "/resources/my-instance/metadata"), r.URL.RequestURI())
assert.Equal(t, fmt.Sprintf("/1.20/services/%s/resources/%s/metadata", FakeTsuruService, "my-instance"), r.URL.RequestURI())
assert.Equal(t, "Bearer f4k3t0k3n", r.Header.Get("Authorization"))
assert.Equal(t, "application/json", r.Header.Get("Content-Type"))
assert.NotNil(t, r.Body)
Expand Down

0 comments on commit 9cebef2

Please sign in to comment.