mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Refactor AssertExistsAndLoadBean to use generics (#20797)
* Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		@@ -49,7 +49,7 @@ func TestPushCommits_ToAPIPayloadCommits(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	pushCommits.HeadCommit = &PushCommit{Sha1: "69554a6"}
 | 
			
		||||
 | 
			
		||||
	repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 16}).(*repo_model.Repository)
 | 
			
		||||
	repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 16})
 | 
			
		||||
	payloadCommits, headCommit, err := pushCommits.ToAPIPayloadCommits(git.DefaultContext, repo.RepoPath(), "/user2/repo16")
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	assert.Len(t, payloadCommits, 3)
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
 | 
			
		||||
	assert.NoError(t, unittest.PrepareTestDatabase())
 | 
			
		||||
 | 
			
		||||
	testTeamRepositories := func(teamID int64, repoIds []int64) {
 | 
			
		||||
		team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID}).(*organization.Team)
 | 
			
		||||
		team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID})
 | 
			
		||||
		assert.NoError(t, team.GetRepositoriesCtx(db.DefaultContext), "%s: GetRepositories", team.Name)
 | 
			
		||||
		assert.Len(t, team.Repos, team.NumRepos, "%s: len repo", team.Name)
 | 
			
		||||
		assert.Len(t, team.Repos, len(repoIds), "%s: repo count", team.Name)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user