@@ -21,6 +21,7 @@ import (
21
21
"path/filepath"
22
22
"runtime"
23
23
"strings"
24
+ "sync/atomic"
24
25
"testing"
25
26
"time"
26
27
@@ -430,19 +431,19 @@ var tokenCounter int64
430
431
431
432
func getTokenForLoggedInUser (t testing.TB , session * TestSession ) string {
432
433
t .Helper ()
433
- tokenCounter ++
434
434
req := NewRequest (t , "GET" , "/user/settings/applications" )
435
435
resp := session .MakeRequest (t , req , http .StatusOK )
436
436
doc := NewHTMLParser (t , resp .Body )
437
437
req = NewRequestWithValues (t , "POST" , "/user/settings/applications" , map [string ]string {
438
438
"_csrf" : doc .GetCSRF (),
439
- "name" : fmt .Sprintf ("api-testing-token-%d" , tokenCounter ),
439
+ "name" : fmt .Sprintf ("api-testing-token-%d" , atomic . AddInt64 ( & tokenCounter , 1 ) ),
440
440
})
441
441
resp = session .MakeRequest (t , req , http .StatusSeeOther )
442
442
req = NewRequest (t , "GET" , "/user/settings/applications" )
443
443
resp = session .MakeRequest (t , req , http .StatusOK )
444
444
htmlDoc := NewHTMLParser (t , resp .Body )
445
445
token := htmlDoc .doc .Find (".ui.info p" ).Text ()
446
+ assert .NotEmpty (t , token )
446
447
return token
447
448
}
448
449
0 commit comments