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

     1  // Copyright 2022 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 TestFeed(t *testing.T) {
    16  	t.Run("User", func(t *testing.T) {
    17  		t.Run("Atom", func(t *testing.T) {
    18  			defer tests.PrepareTestEnv(t)()
    19  
    20  			req := NewRequest(t, "GET", "/user2.atom")
    21  			resp := MakeRequest(t, req, http.StatusOK)
    22  
    23  			data := resp.Body.String()
    24  			assert.Contains(t, data, `<feed xmlns="http://www.w3.org/2005/Atom"`)
    25  		})
    26  
    27  		t.Run("RSS", func(t *testing.T) {
    28  			defer tests.PrepareTestEnv(t)()
    29  
    30  			req := NewRequest(t, "GET", "/user2.rss")
    31  			resp := MakeRequest(t, req, http.StatusOK)
    32  
    33  			data := resp.Body.String()
    34  			assert.Contains(t, data, `<rss version="2.0"`)
    35  		})
    36  	})
    37  }