9
9
"net/http"
10
10
"net/url"
11
11
"strconv"
12
- "strings"
13
12
"testing"
14
13
"time"
15
14
@@ -20,7 +19,6 @@ import (
20
19
"code.gitea.io/gitea/modules/git"
21
20
"code.gitea.io/gitea/modules/gitrepo"
22
21
"code.gitea.io/gitea/modules/setting"
23
- gitea_context "code.gitea.io/gitea/services/context"
24
22
"code.gitea.io/gitea/services/migrations"
25
23
mirror_service "code.gitea.io/gitea/services/mirror"
26
24
repo_service "code.gitea.io/gitea/services/repository"
@@ -92,9 +90,8 @@ func testCreatePushMirror(t *testing.T, session *TestSession, owner, repo, addre
92
90
})
93
91
session .MakeRequest (t , req , http .StatusSeeOther )
94
92
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 )
98
95
}
99
96
100
97
func 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,
104
101
"push_mirror_id" : strconv .FormatInt (pushMirrorID , 10 ),
105
102
})
106
103
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 )
109
106
}
110
107
111
108
func doUpdatePushMirror (t * testing.T , session * TestSession , owner , repo string , pushMirrorID int64 , interval string ) bool {
0 commit comments