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.

29 lines
760 B

  1. package api
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestNoRouteVersionNotProvided(t *testing.T) {
  7. endpoint := apiIP + apiPort + "/"
  8. // not using doGoodReq, bcs internally
  9. // there is a method FindRoute that checks route and returns error
  10. resp, err := doSimpleReq("GET", endpoint)
  11. assert.NoError(t, err)
  12. assert.Equal(t,
  13. "{\"error\":\"Version not provided, please provide a valid version in the path such as v1\"}\n",
  14. resp)
  15. }
  16. func TestNoRoute(t *testing.T) {
  17. endpoint := apiURL
  18. // not using doGoodReq, bcs internally
  19. // there is a method FindRoute that checks route and returns error
  20. resp, err := doSimpleReq("GET", endpoint)
  21. assert.NoError(t, err)
  22. assert.Equal(t,
  23. "{\"error\":\"404 page not found\"}\n",
  24. resp)
  25. }