From 06df2c91cfccb5f2c49290dd68a3669882a4df7a Mon Sep 17 00:00:00 2001 From: David Schneiderbauer Date: Wed, 13 Jun 2018 10:37:57 +0200 Subject: [PATCH] add landing page test --- integrations/setting_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/integrations/setting_test.go b/integrations/setting_test.go index a8d1f01e8..2aac8e90e 100644 --- a/integrations/setting_test.go +++ b/integrations/setting_test.go @@ -68,3 +68,25 @@ func TestSettingShowUserEmailProfile(t *testing.T) { setting.UI.ShowUserEmail = showUserEmail } + +func TestSettingLandingPage(t *testing.T) { + prepareTestEnv(t) + + landingPage := setting.LandingPageURL + + setting.LandingPageURL = setting.LandingPageHome + req := NewRequest(t, "GET", "/") + MakeRequest(t, req, http.StatusOK) + + setting.LandingPageURL = setting.LandingPageExplore + req = NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusFound) + assert.Equal(t, "/explore", resp.Header().Get("Location")) + + setting.LandingPageURL = setting.LandingPageOrganizations + req = NewRequest(t, "GET", "/") + resp = MakeRequest(t, req, http.StatusFound) + assert.Equal(t, "/explore/organizations", resp.Header().Get("Location")) + + setting.LandingPageURL = landingPage +}