Skip to content

Commit

Permalink
Pass by value in for loop, not by reference. (#953)
Browse files Browse the repository at this point in the history
* Pass by value in for loop, not by reference.

* DXCDT-400: Allowing piped-in templates into `auth0 ul templates update` (#950)

Adding piped-in HTML and updated docs

* Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0 (#951)

Bumps [github.com/hashicorp/terraform-exec](https://github.com/hashicorp/terraform-exec) from 0.19.0 to 0.20.0.
- [Release notes](https://github.com/hashicorp/terraform-exec/releases)
- [Changelog](https://github.com/hashicorp/terraform-exec/blob/main/CHANGELOG.md)
- [Commits](hashicorp/terraform-exec@v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/terraform-exec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Organize imports

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Will Vedder <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 21, 2023
1 parent 859f796 commit 76f97dd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/display/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func (r *Renderer) MembersList(members []management.OrganizationMember) {

var res []View
for _, m := range members {
res = append(res, makeMembersView(&m))
res = append(res, makeMembersView(m))
}

r.Results(res)
}

func makeMembersView(member *management.OrganizationMember) *membersView {
func makeMembersView(member management.OrganizationMember) *membersView {
return &membersView{
ID: member.GetUserID(),
Name: member.GetName(),
Expand Down
36 changes: 36 additions & 0 deletions internal/display/members_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package display

import (
"bytes"
"encoding/json"
"io"
"testing"

"github.com/auth0/go-auth0/management"
"github.com/stretchr/testify/assert"
)

func TestRenderer_MembersList_json(t *testing.T) {
var input []management.OrganizationMember
for _, id := range []string{"1234", "5678"} {
nid := id
input = append(input, management.OrganizationMember{UserID: &nid})
}

var exp []interface{}
raw, _ := json.Marshal(input)
_ = json.Unmarshal(raw, &exp)

r := NewRenderer()
r.Format = OutputFormatJSON

out := bytes.NewBuffer([]byte{})
r.ResultWriter = out
r.MembersList(input)
buf, _ := io.ReadAll(out)

var got []interface{}
_ = json.Unmarshal(buf, &got)

assert.Equal(t, exp, got)
}

0 comments on commit 76f97dd

Please sign in to comment.