mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 12:37:14 -04:00 
			
		
		
		
	* Fix bug on getIssueIDsByRepoID * Add test
This commit is contained in:
		| @@ -1086,7 +1086,7 @@ func getIssuesByIDs(e Engine, issueIDs []int64) ([]*Issue, error) { | |||||||
|  |  | ||||||
| func getIssueIDsByRepoID(e Engine, repoID int64) ([]int64, error) { | func getIssueIDsByRepoID(e Engine, repoID int64) ([]int64, error) { | ||||||
| 	ids := make([]int64, 0, 10) | 	ids := make([]int64, 0, 10) | ||||||
| 	err := e.Table("issue").Where("repo_id = ?", repoID).Find(&ids) | 	err := e.Table("issue").Cols("id").Where("repo_id = ?", repoID).Find(&ids) | ||||||
| 	return ids, err | 	return ids, err | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -36,6 +36,14 @@ func TestIssue_ReplaceLabels(t *testing.T) { | |||||||
| 	testSuccess(1, []int64{}) | 	testSuccess(1, []int64{}) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func Test_GetIssueIDsByRepoID(t *testing.T) { | ||||||
|  | 	assert.NoError(t, PrepareTestDatabase()) | ||||||
|  |  | ||||||
|  | 	ids, err := GetIssueIDsByRepoID(1) | ||||||
|  | 	assert.NoError(t, err) | ||||||
|  | 	assert.Len(t, ids, 5) | ||||||
|  | } | ||||||
|  |  | ||||||
| func TestIssueAPIURL(t *testing.T) { | func TestIssueAPIURL(t *testing.T) { | ||||||
| 	assert.NoError(t, PrepareTestDatabase()) | 	assert.NoError(t, PrepareTestDatabase()) | ||||||
| 	issue := AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) | 	issue := AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user