@@ -10,6 +10,7 @@ import (
1010
1111 issues_model "code.gitea.io/gitea/models/issues"
1212 "code.gitea.io/gitea/models/unittest"
13+ "code.gitea.io/gitea/modules/contexttest"
1314 "code.gitea.io/gitea/modules/repository"
1415 "code.gitea.io/gitea/modules/test"
1516 "code.gitea.io/gitea/modules/web"
@@ -32,9 +33,9 @@ func int64SliceToCommaSeparated(a []int64) string {
3233func TestInitializeLabels (t * testing.T ) {
3334 unittest .PrepareTestEnv (t )
3435 assert .NoError (t , repository .LoadRepoConfig ())
35- ctx , _ := test .MockContext (t , "user2/repo1/labels/initialize" )
36- test .LoadUser (t , ctx , 2 )
37- test .LoadRepo (t , ctx , 2 )
36+ ctx , _ := contexttest .MockContext (t , "user2/repo1/labels/initialize" )
37+ contexttest .LoadUser (t , ctx , 2 )
38+ contexttest .LoadRepo (t , ctx , 2 )
3839 web .SetForm (ctx , & forms.InitializeLabelsForm {TemplateName : "Default" })
3940 InitializeLabels (ctx )
4041 assert .EqualValues (t , http .StatusSeeOther , ctx .Resp .Status ())
@@ -57,9 +58,9 @@ func TestRetrieveLabels(t *testing.T) {
5758 {1 , "leastissues" , []int64 {2 , 1 }},
5859 {2 , "" , []int64 {}},
5960 } {
60- ctx , _ := test .MockContext (t , "user/repo/issues" )
61- test .LoadUser (t , ctx , 2 )
62- test .LoadRepo (t , ctx , testCase .RepoID )
61+ ctx , _ := contexttest .MockContext (t , "user/repo/issues" )
62+ contexttest .LoadUser (t , ctx , 2 )
63+ contexttest .LoadRepo (t , ctx , testCase .RepoID )
6364 ctx .Req .Form .Set ("sort" , testCase .Sort )
6465 RetrieveLabels (ctx )
6566 assert .False (t , ctx .Written ())
@@ -75,9 +76,9 @@ func TestRetrieveLabels(t *testing.T) {
7576
7677func TestNewLabel (t * testing.T ) {
7778 unittest .PrepareTestEnv (t )
78- ctx , _ := test .MockContext (t , "user2/repo1/labels/edit" )
79- test .LoadUser (t , ctx , 2 )
80- test .LoadRepo (t , ctx , 1 )
79+ ctx , _ := contexttest .MockContext (t , "user2/repo1/labels/edit" )
80+ contexttest .LoadUser (t , ctx , 2 )
81+ contexttest .LoadRepo (t , ctx , 1 )
8182 web .SetForm (ctx , & forms.CreateLabelForm {
8283 Title : "newlabel" ,
8384 Color : "#abcdef" ,
@@ -93,9 +94,9 @@ func TestNewLabel(t *testing.T) {
9394
9495func TestUpdateLabel (t * testing.T ) {
9596 unittest .PrepareTestEnv (t )
96- ctx , _ := test .MockContext (t , "user2/repo1/labels/edit" )
97- test .LoadUser (t , ctx , 2 )
98- test .LoadRepo (t , ctx , 1 )
97+ ctx , _ := contexttest .MockContext (t , "user2/repo1/labels/edit" )
98+ contexttest .LoadUser (t , ctx , 2 )
99+ contexttest .LoadRepo (t , ctx , 1 )
99100 web .SetForm (ctx , & forms.CreateLabelForm {
100101 ID : 2 ,
101102 Title : "newnameforlabel" ,
@@ -114,9 +115,9 @@ func TestUpdateLabel(t *testing.T) {
114115
115116func TestDeleteLabel (t * testing.T ) {
116117 unittest .PrepareTestEnv (t )
117- ctx , _ := test .MockContext (t , "user2/repo1/labels/delete" )
118- test .LoadUser (t , ctx , 2 )
119- test .LoadRepo (t , ctx , 1 )
118+ ctx , _ := contexttest .MockContext (t , "user2/repo1/labels/delete" )
119+ contexttest .LoadUser (t , ctx , 2 )
120+ contexttest .LoadRepo (t , ctx , 1 )
120121 ctx .Req .Form .Set ("id" , "2" )
121122 DeleteLabel (ctx )
122123 assert .EqualValues (t , http .StatusOK , ctx .Resp .Status ())
@@ -127,9 +128,9 @@ func TestDeleteLabel(t *testing.T) {
127128
128129func TestUpdateIssueLabel_Clear (t * testing.T ) {
129130 unittest .PrepareTestEnv (t )
130- ctx , _ := test .MockContext (t , "user2/repo1/issues/labels" )
131- test .LoadUser (t , ctx , 2 )
132- test .LoadRepo (t , ctx , 1 )
131+ ctx , _ := contexttest .MockContext (t , "user2/repo1/issues/labels" )
132+ contexttest .LoadUser (t , ctx , 2 )
133+ contexttest .LoadRepo (t , ctx , 1 )
133134 ctx .Req .Form .Set ("issue_ids" , "1,3" )
134135 ctx .Req .Form .Set ("action" , "clear" )
135136 UpdateIssueLabel (ctx )
@@ -152,9 +153,9 @@ func TestUpdateIssueLabel_Toggle(t *testing.T) {
152153 {"toggle" , []int64 {1 , 2 }, 2 , true },
153154 } {
154155 unittest .PrepareTestEnv (t )
155- ctx , _ := test .MockContext (t , "user2/repo1/issues/labels" )
156- test .LoadUser (t , ctx , 2 )
157- test .LoadRepo (t , ctx , 1 )
156+ ctx , _ := contexttest .MockContext (t , "user2/repo1/issues/labels" )
157+ contexttest .LoadUser (t , ctx , 2 )
158+ contexttest .LoadRepo (t , ctx , 1 )
158159 ctx .Req .Form .Set ("issue_ids" , int64SliceToCommaSeparated (testCase .IssueIDs ))
159160 ctx .Req .Form .Set ("action" , testCase .Action )
160161 ctx .Req .Form .Set ("id" , strconv .Itoa (int (testCase .LabelID )))
0 commit comments