mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Less verbose integration tests (#2123)
* Helper functions for intergration test boilerplate
This commit is contained in:
		
				
					committed by
					
						
						Kim "BKC" Carlbäcker
					
				
			
			
				
	
			
			
			
						parent
						
							5651cc7413
						
					
				
				
					commit
					f1adaef458
				
			@@ -7,22 +7,18 @@ package integrations
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestAPIUserReposNotLogin(t *testing.T) {
 | 
			
		||||
	prepareTestEnv(t)
 | 
			
		||||
 | 
			
		||||
	req := NewRequest(t, "GET", "/api/v1/users/user2/repos")
 | 
			
		||||
	resp := MakeRequest(req)
 | 
			
		||||
	assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
 | 
			
		||||
	MakeRequest(t, req, http.StatusOK)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestAPISearchRepoNotLogin(t *testing.T) {
 | 
			
		||||
	prepareTestEnv(t)
 | 
			
		||||
 | 
			
		||||
	req := NewRequest(t, "GET", "/api/v1/repos/search?q=Test")
 | 
			
		||||
	resp := MakeRequest(req)
 | 
			
		||||
	assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
 | 
			
		||||
	MakeRequest(t, req, http.StatusOK)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user