From 76afc9324f46b4941a5a90d93e43f4f392807487 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 31 Oct 2024 20:57:54 +0100 Subject: [PATCH] adjust tests (2) --- tests/integration/repo_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/repo_test.go b/tests/integration/repo_test.go index a43635363f..7eab78f2f2 100644 --- a/tests/integration/repo_test.go +++ b/tests/integration/repo_test.go @@ -27,6 +27,10 @@ func TestViewRepo(t *testing.T) { req := NewRequest(t, "GET", "/user2/repo1") resp := session.MakeRequest(t, req, http.StatusOK) + link := resp.Result().Header.Get("Location") + req = NewRequest(t, "GET", link) + resp = session.MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) repoTopics := htmlDoc.doc.Find("#repo-topics").Children() repoSummary := htmlDoc.doc.Find(".repository-summary").Children() @@ -44,7 +48,7 @@ func TestViewRepo(t *testing.T) { func testViewRepo(t *testing.T) { defer tests.PrepareTestEnv(t)() - req := NewRequest(t, "GET", "/org3/repo3") + req := NewRequest(t, "GET", "/org3/repo3/code") session := loginUser(t, "user2") resp := session.MakeRequest(t, req, http.StatusOK) @@ -124,7 +128,11 @@ func TestViewRepo1CloneLinkAnonymous(t *testing.T) { defer tests.PrepareTestEnv(t)() req := NewRequest(t, "GET", "/user2/repo1") - resp := MakeRequest(t, req, http.StatusOK) + resp := MakeRequest(t, req, http.StatusMovedPermanently) + + link := resp.Result().Header.Get("Location") + req = NewRequest(t, "GET", link) + resp = MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) link, exists := htmlDoc.doc.Find("#repo-clone-https").Attr("data-link")