Go client for the Write.as API https://developers.write.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
691 B

  1. package writeas
  2. import "testing"
  3. func TestClient_CreateContributor(t *testing.T) {
  4. c := NewClientWith(Config{URL: "http://localhost:7777/api"})
  5. _, err := c.LogIn("test", "test")
  6. if err != nil {
  7. t.Fatalf("login: %s", err)
  8. }
  9. tests := []struct {
  10. name string
  11. AName string
  12. ASlug string
  13. AOrg string
  14. }{
  15. {
  16. name: "good",
  17. AName: "Bob Contrib",
  18. ASlug: "bob",
  19. AOrg: "write-as",
  20. },
  21. }
  22. for _, test := range tests {
  23. t.Run(test.name, func(t *testing.T) {
  24. _, err = c.CreateContributor(&AuthorParams{
  25. Name: test.AName,
  26. Slug: test.ASlug,
  27. OrgAlias: test.AOrg,
  28. })
  29. if err != nil {
  30. t.Fatalf("create %s: %s", test.name, err)
  31. }
  32. })
  33. }
  34. }