@@ -18,6 +18,7 @@ import (
18
18
"os"
19
19
"path/filepath"
20
20
"strings"
21
+ "sync/atomic"
21
22
"testing"
22
23
"time"
23
24
@@ -263,19 +264,19 @@ var tokenCounter int64
263
264
264
265
func getTokenForLoggedInUser (t testing.TB , session * TestSession ) string {
265
266
t .Helper ()
266
- tokenCounter ++
267
267
req := NewRequest (t , "GET" , "/user/settings/applications" )
268
268
resp := session .MakeRequest (t , req , http .StatusOK )
269
269
doc := NewHTMLParser (t , resp .Body )
270
270
req = NewRequestWithValues (t , "POST" , "/user/settings/applications" , map [string ]string {
271
271
"_csrf" : doc .GetCSRF (),
272
- "name" : fmt .Sprintf ("api-testing-token-%d" , tokenCounter ),
272
+ "name" : fmt .Sprintf ("api-testing-token-%d" , atomic . AddInt64 ( & tokenCounter , 1 ) ),
273
273
})
274
274
session .MakeRequest (t , req , http .StatusSeeOther )
275
275
req = NewRequest (t , "GET" , "/user/settings/applications" )
276
276
resp = session .MakeRequest (t , req , http .StatusOK )
277
277
htmlDoc := NewHTMLParser (t , resp .Body )
278
278
token := htmlDoc .doc .Find (".ui.info p" ).Text ()
279
+ assert .NotEmpty (t , token )
279
280
return token
280
281
}
281
282
0 commit comments