adminapi_test.go 582 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "io/ioutil"
  4. "net/http"
  5. "testing"
  6. )
  7. func TestGetBackend(t *testing.T) {
  8. url := baseSslURL + restEndpoints + "admin/backends/mybe/"
  9. resp, err := getGetRequest(url, AdminUser)
  10. if err != nil {
  11. t.Errorf("Error getting response. %v", err)
  12. return
  13. }
  14. defer resp.Body.Close()
  15. bodyText, err := ioutil.ReadAll(resp.Body)
  16. s := string(bodyText)
  17. t.Logf("response: url: %s, response: %s", url, s)
  18. if resp.StatusCode != http.StatusOK {
  19. t.Errorf("Wrong statuscode: %d", resp.StatusCode)
  20. return
  21. }
  22. t.Log("Get Backend OK.")
  23. }