mirror of
https://github.com/writeas/go-writeas.git
synced 2025-07-27 15:18:28 +00:00
38 lines
691 B
Go
38 lines
691 B
Go
package writeas
|
|
|
|
import "testing"
|
|
|
|
func TestClient_CreateContributor(t *testing.T) {
|
|
c := NewClientWith(Config{URL: "http://localhost:7777/api"})
|
|
_, err := c.LogIn("test", "test")
|
|
if err != nil {
|
|
t.Fatalf("login: %s", err)
|
|
}
|
|
|
|
tests := []struct {
|
|
name string
|
|
AName string
|
|
ASlug string
|
|
AOrg string
|
|
}{
|
|
{
|
|
name: "good",
|
|
AName: "Bob Contrib",
|
|
ASlug: "bob",
|
|
AOrg: "write-as",
|
|
},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
_, err = c.CreateContributor(&AuthorParams{
|
|
Name: test.AName,
|
|
Slug: test.ASlug,
|
|
OrgAlias: test.AOrg,
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("create %s: %s", test.name, err)
|
|
}
|
|
})
|
|
}
|
|
}
|