From 43cde371d2587b2742a7ada06371d5348d6b35bb Mon Sep 17 00:00:00 2001 From: davrot Date: Fri, 14 Feb 2025 23:54:11 +0000 Subject: [PATCH] =?UTF-8?q?Dateien=20nach=20=E2=80=9Etests/integration?= =?UTF-8?q?=E2=80=9C=20hochladen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/integration/landingpagedetails_test.go | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/integration/landingpagedetails_test.go diff --git a/tests/integration/landingpagedetails_test.go b/tests/integration/landingpagedetails_test.go new file mode 100644 index 0000000000..09760f3f49 --- /dev/null +++ b/tests/integration/landingpagedetails_test.go @@ -0,0 +1,39 @@ +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" + "code.gitea.io/gitea/tests" +) + +func TestLandingPageDetailsDefault(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", true) +} + +func TestLandingPageDetailsTrue(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.LandingPageDetails, true)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", true) +} + +func TestLandingPageDetailsFalse(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.LandingPageDetails, false)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", false) +}