code.gitea.io/gitea@v1.21.7/tests/integration/pull_compare_test.go (about)

     1  // Copyright 2017 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package integration
     5  
     6  import (
     7  	"net/http"
     8  	"testing"
     9  
    10  	"code.gitea.io/gitea/tests"
    11  
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestPullCompare(t *testing.T) {
    16  	defer tests.PrepareTestEnv(t)()
    17  
    18  	session := loginUser(t, "user2")
    19  	req := NewRequest(t, "GET", "/user2/repo1/pulls")
    20  	resp := session.MakeRequest(t, req, http.StatusOK)
    21  	htmlDoc := NewHTMLParser(t, resp.Body)
    22  	link, exists := htmlDoc.doc.Find(".new-pr-button").Attr("href")
    23  	assert.True(t, exists, "The template has changed")
    24  
    25  	req = NewRequest(t, "GET", link)
    26  	resp = session.MakeRequest(t, req, http.StatusOK)
    27  	assert.EqualValues(t, http.StatusOK, resp.Code)
    28  }