mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix not respecting landing page setting (#4209)
* fix not respecting landing page setting * fmt * add landing page test
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							6efdcaed86
						
					
				
				
					commit
					adba2ad609
				
			@@ -68,3 +68,25 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	setting.UI.ShowUserEmail = showUserEmail
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestSettingLandingPage(t *testing.T) {
 | 
			
		||||
	prepareTestEnv(t)
 | 
			
		||||
 | 
			
		||||
	landingPage := setting.LandingPageURL
 | 
			
		||||
 | 
			
		||||
	setting.LandingPageURL = setting.LandingPageHome
 | 
			
		||||
	req := NewRequest(t, "GET", "/")
 | 
			
		||||
	MakeRequest(t, req, http.StatusOK)
 | 
			
		||||
 | 
			
		||||
	setting.LandingPageURL = setting.LandingPageExplore
 | 
			
		||||
	req = NewRequest(t, "GET", "/")
 | 
			
		||||
	resp := MakeRequest(t, req, http.StatusFound)
 | 
			
		||||
	assert.Equal(t, "/explore", resp.Header().Get("Location"))
 | 
			
		||||
 | 
			
		||||
	setting.LandingPageURL = setting.LandingPageOrganizations
 | 
			
		||||
	req = NewRequest(t, "GET", "/")
 | 
			
		||||
	resp = MakeRequest(t, req, http.StatusFound)
 | 
			
		||||
	assert.Equal(t, "/explore/organizations", resp.Header().Get("Location"))
 | 
			
		||||
 | 
			
		||||
	setting.LandingPageURL = landingPage
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user