mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Convert API tests to standard Go lib (#29009)
* Chore: Convert tests to standard Go lib Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
@@ -27,14 +27,14 @@ func TestGetUrl(t *testing.T) {
|
||||
|
||||
t.Run("And protocol HTTP configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
rs.Cfg.AppSubURL = ""
|
||||
setting.Protocol = setting.HTTPScheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "http://localhost:3000/"+path+"&render=1", url)
|
||||
|
||||
t.Run("And serve from sub path should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = true
|
||||
rs.Cfg.AppSubUrl = "/grafana"
|
||||
rs.Cfg.AppSubURL = "/grafana"
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "http://localhost:3000/grafana/"+path+"&render=1", url)
|
||||
})
|
||||
@@ -42,7 +42,7 @@ func TestGetUrl(t *testing.T) {
|
||||
|
||||
t.Run("And protocol HTTPS configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
rs.Cfg.AppSubURL = ""
|
||||
setting.Protocol = setting.HTTPSScheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "https://localhost:3000/"+path+"&render=1", url)
|
||||
@@ -50,7 +50,7 @@ func TestGetUrl(t *testing.T) {
|
||||
|
||||
t.Run("And protocol HTTP2 configured should return expected path", func(t *testing.T) {
|
||||
rs.Cfg.ServeFromSubPath = false
|
||||
rs.Cfg.AppSubUrl = ""
|
||||
rs.Cfg.AppSubURL = ""
|
||||
setting.Protocol = setting.HTTP2Scheme
|
||||
url := rs.getURL(path)
|
||||
require.Equal(t, "https://localhost:3000/"+path+"&render=1", url)
|
||||
|
||||
Reference in New Issue
Block a user