99 "net/http"
1010 "net/url"
1111 "strconv"
12- "strings"
1312 "testing"
1413 "time"
1514
@@ -20,7 +19,6 @@ import (
2019 "code.gitea.io/gitea/modules/git"
2120 "code.gitea.io/gitea/modules/gitrepo"
2221 "code.gitea.io/gitea/modules/setting"
23- gitea_context "code.gitea.io/gitea/services/context"
2422 "code.gitea.io/gitea/services/migrations"
2523 mirror_service "code.gitea.io/gitea/services/mirror"
2624 repo_service "code.gitea.io/gitea/services/repository"
@@ -92,9 +90,8 @@ func testCreatePushMirror(t *testing.T, session *TestSession, owner, repo, addre
9290 })
9391 session .MakeRequest (t , req , http .StatusSeeOther )
9492
95- flashCookie := session .GetCookie (gitea_context .CookieNameFlash )
96- assert .NotNil (t , flashCookie )
97- assert .Contains (t , flashCookie .Value , "success" )
93+ flashMsg := session .GetCookieFlashMessage ()
94+ assert .NotEmpty (t , flashMsg .SuccessMsg )
9895}
9996
10097func doRemovePushMirror (t * testing.T , session * TestSession , owner , repo string , pushMirrorID int64 ) bool {
@@ -104,8 +101,8 @@ func doRemovePushMirror(t *testing.T, session *TestSession, owner, repo string,
104101 "push_mirror_id" : strconv .FormatInt (pushMirrorID , 10 ),
105102 })
106103 resp := session .MakeRequest (t , req , NoExpectedStatus )
107- flashCookie := session .GetCookie ( gitea_context . CookieNameFlash )
108- return resp .Code == http .StatusSeeOther && flashCookie != nil && strings . Contains ( flashCookie . Value , "success" )
104+ flashMsg := session .GetCookieFlashMessage ( )
105+ return resp .Code == http .StatusSeeOther && assert . NotEmpty ( t , flashMsg . SuccessMsg )
109106}
110107
111108func doUpdatePushMirror (t * testing.T , session * TestSession , owner , repo string , pushMirrorID int64 , interval string ) bool {
0 commit comments