dataproxy_test.go 674 B

12345678910111213141516171819
  1. package api
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestDataProxy(t *testing.T) {
  7. Convey("Data proxy test", t, func() {
  8. Convey("Should append trailing slash to proxy path if original path has a trailing slash", func() {
  9. So(ensureProxyPathTrailingSlash("/api/datasources/proxy/6/api/v1/query_range/", "api/v1/query_range/"), ShouldEqual, "api/v1/query_range/")
  10. })
  11. Convey("Should not append trailing slash to proxy path if original path doesn't have a trailing slash", func() {
  12. So(ensureProxyPathTrailingSlash("/api/datasources/proxy/6/api/v1/query_range", "api/v1/query_range"), ShouldEqual, "api/v1/query_range")
  13. })
  14. })
  15. }