Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Oct 12, 2022
1 parent 44f1170 commit 0c76040
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions account_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (api *API) AccountMembers(ctx context.Context, accountID string, pageOpts P
//
// Refer to the API reference for valid statuses.
//
// Deprecated: Use `CreateAccountMember` with a `Status` field instead.
//
// API reference: https://api.cloudflare.com/#account-members-add-member
func (api *API) CreateAccountMemberWithStatus(ctx context.Context, accountID string, emailAddress string, roles []string, status string) (AccountMember, error) {
return api.CreateAccountMember(ctx, AccountIdentifier(accountID), CreateAccountMemberParams{
Expand All @@ -104,8 +106,8 @@ func (api *API) CreateAccountMemberWithStatus(ctx context.Context, accountID str

// CreateAccountMember invites a new member to join an account with roles.
// The member will be placed into "pending" status and receive an email confirmation.
// NOTE: If you are currently enrolled in Domain Scoped Roles, your roles will be converted to policies
// upon member invitation.
// NOTE: If you are currently enrolled in Domain Scoped Roles, your roles will
// be converted to policies upon member invitation.
//
// API reference: https://api.cloudflare.com/#account-members-add-member
func (api *API) CreateAccountMember(ctx context.Context, rc *ResourceContainer, params CreateAccountMemberParams) (AccountMember, error) {
Expand Down
14 changes: 7 additions & 7 deletions account_members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestAccountMembers(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members", handler)
want := []AccountMember{expectedAccountMemberStruct}

actual, _, err := client.AccountMembers(context.Background(), "01a7362d577a6c3019a474fd6f485823", PaginationOptions{})
Expand Down Expand Up @@ -251,7 +251,7 @@ func TestCreateAccountMemberWithStatus(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members", handler)

actual, err := client.CreateAccountMemberWithStatus(context.Background(), "01a7362d577a6c3019a474fd6f485823", "[email protected]", []string{"3536bcfad5faccb999b47003c79917fb"}, "accepted")

Expand Down Expand Up @@ -302,7 +302,7 @@ func TestCreateAccountMember(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members", handler)

createAccountParams := CreateAccountMemberParams{
EmailAddress: "[email protected]",
Expand Down Expand Up @@ -365,7 +365,7 @@ func TestCreateAccountMemberWithPolicies(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members", handler)
actual, err := client.CreateAccountMember(context.Background(), AccountIdentifier("01a7362d577a6c3019a474fd6f485823"), CreateAccountMemberParams{
EmailAddress: "[email protected]",
Roles: nil,
Expand Down Expand Up @@ -465,7 +465,7 @@ func TestUpdateAccountMember(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members/4536bcfad5faccb111b47003c79917fa", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members/4536bcfad5faccb111b47003c79917fa", handler)

actual, err := client.UpdateAccountMember(context.Background(), "01a7362d577a6c3019a474fd6f485823", "4536bcfad5faccb111b47003c79917fa", newUpdatedAccountMemberStruct)

Expand Down Expand Up @@ -528,7 +528,7 @@ func TestUpdateAccountMemberWithPolicies(t *testing.T) {
}`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members/new-member-with-polcies-id", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members/new-member-with-polcies-id", handler)

actual, err := client.UpdateAccountMember(context.Background(), "01a7362d577a6c3019a474fd6f485823", "new-member-with-polcies-id", expectedNewAccountMemberWithPoliciesStruct)

Expand Down Expand Up @@ -612,7 +612,7 @@ func TestAccountMember(t *testing.T) {
`)
}

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823/members/4536bcfad5faccb111b47003c79917fa", handler)
mux.HandleFunc("/accounts/"+testAccountID+"/members/4536bcfad5faccb111b47003c79917fa", handler)

actual, err := client.AccountMember(context.Background(), "01a7362d577a6c3019a474fd6f485823", "4536bcfad5faccb111b47003c79917fa")

Expand Down

0 comments on commit 0c76040

Please sign in to comment.