Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
komalali committed Nov 16, 2023
1 parent 63115de commit 56d9a52
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion provider/pkg/internal/pulumiapi/orgtokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (c *Client) DeleteOrgAccessToken(ctx context.Context, tokenId, orgName stri
}

func (c *Client) GetOrgAccessToken(ctx context.Context, tokenId, orgName string) (*AccessToken, error) {
apiPath := path.Join("orgs", orgName, "tokens", tokenId)
apiPath := path.Join("orgs", orgName, "tokens")

var listRes listTokenResponse

Expand Down
7 changes: 2 additions & 5 deletions provider/pkg/internal/pulumiapi/orgtokens_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package pulumiapi

import (
"context"
"fmt"
"net/http"
"testing"

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

var orgCtx = context.Background()

func TestDeleteOrgAccessToken(t *testing.T) {
orgName := "anOrg"
tokenId := "abcdegh"
Expand Down Expand Up @@ -151,7 +148,7 @@ func TestGetOrgAccessToken(t *testing.T) {
ResponseBody: resp,
})
defer cleanup()
token, err := c.GetOrgAccessToken(ctx, org, id)
token, err := c.GetOrgAccessToken(ctx, id, org)
assert.NoError(t, err)
assert.Equal(t, &AccessToken{
ID: id,
Expand All @@ -171,7 +168,7 @@ func TestGetOrgAccessToken(t *testing.T) {
},
})
defer cleanup()
token, err := c.GetOrgAccessToken(ctx, org, id)
token, err := c.GetOrgAccessToken(ctx, id, org)
assert.Nil(t, token, "token should be nil")
assert.EqualError(t,
err,
Expand Down
2 changes: 1 addition & 1 deletion provider/pkg/internal/pulumiapi/teamtokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (c *Client) DeleteTeamAccessToken(ctx context.Context, tokenId, orgName, te
}

func (c *Client) GetTeamAccessToken(ctx context.Context, tokenId, orgName, teamName string) (*AccessToken, error) {
apiPath := path.Join("orgs", orgName, "teams", teamName, "tokens", tokenId)
apiPath := path.Join("orgs", orgName, "teams", teamName, "tokens")

var listRes listTokenResponse

Expand Down
4 changes: 2 additions & 2 deletions provider/pkg/internal/pulumiapi/teamtokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestGetTeamAccessToken(t *testing.T) {
ResponseBody: resp,
})
defer cleanup()
token, err := c.GetTeamAccessToken(ctx, org, team, id)
token, err := c.GetTeamAccessToken(ctx, id, org, team)
assert.NoError(t, err)
assert.Equal(t, &AccessToken{
ID: id,
Expand All @@ -147,7 +147,7 @@ func TestGetTeamAccessToken(t *testing.T) {
},
})
defer cleanup()
token, err := c.GetTeamAccessToken(ctx, org, team, id)
token, err := c.GetTeamAccessToken(ctx, id, org, team)
assert.Nil(t, token, "token should be nil")
assert.EqualError(t,
err,
Expand Down

0 comments on commit 56d9a52

Please sign in to comment.