Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

AdminCreateUser fails with json: cannot unmarshal array into Go value of type map[string]interface {} #79

Open
klauern opened this issue Nov 23, 2017 · 5 comments

Comments

@klauern
Copy link

klauern commented Nov 23, 2017

Similar to #40, I noticed this when trying to use this SDK to write a Terraform provider plugin.

package gitea

import (
	"fmt"
	"testing"

	"code.gitea.io/sdk/gitea"
)

func TestGiteaUserCreate(t *testing.T) {
	client := gitea.NewClient("http://localhost:3000", "978fd3ee4f71d6cf8a87556201d37293d719230d")
	user, err := client.AdminCreateUser(gitea.CreateUserOption{
		Email:     "[email protected]",
		LoginName: "random",
		Username:  "random",
	})

	if err != nil {
		t.Fatal(err)
	}

	fmt.Printf("%#v", user)

}
@klauern
Copy link
Author

klauern commented Nov 23, 2017

Output of test:

Parsed Response for path /admin/users
--- FAIL: TestGiteaUserCreate (0.02s)
        gitea_api_test.go:19: json: cannot unmarshal array into Go value of type map[string]interface {}
FAIL
FAIL    github.com/klauern/terraform-gitea-provider/gitea       0.104s

@lunny
Copy link
Member

lunny commented Nov 25, 2017

Is this duplicated with #40

@klauern
Copy link
Author

klauern commented Nov 25, 2017

Is it using the same underlying JSON Decoder, or is it a separate struct for the response?

@lunny
Copy link
Member

lunny commented Nov 26, 2017

@klauern how about add your test on this project and let host and secret as an environment?

@klauern
Copy link
Author

klauern commented Nov 26, 2017

That's easy enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants