@@ -419,12 +419,9 @@ def do_confluence_login(locust, usr, pwd, do_websudo=False):
419
419
}
420
420
system_info_html = locust .post (url = '/doauthenticate.action' , data = auth_body ,
421
421
headers = {'X-Atlassian-Token' : 'no-check' }, catch_response = True )
422
- print (system_info_html .content .decode ('utf-8' ))
423
422
424
423
425
-
426
-
427
- def do_login_jira (locust , usr , pwd ):
424
+ def do_login_jira (locust , usr , pwd , do_websudo = False ):
428
425
locust .client .cookies .clear ()
429
426
body = LOGIN_BODY
430
427
body ['os_username' ] = usr
@@ -468,6 +465,16 @@ def do_login_jira(locust, usr, pwd):
468
465
token = fetch_by_re (locust .session_data_storage ['token_pattern' ], content )
469
466
locust .session_data_storage ["token" ] = token
470
467
468
+ if do_websudo :
469
+ auth_body = {
470
+ 'webSudoDestination' : '/secure/admin/ViewSystemInfo.jspa' ,
471
+ 'webSudoIsPost' : False ,
472
+ 'webSudoPassword' : pwd ,
473
+ 'atl_token' : locust .session_data_storage ["token" ]
474
+ }
475
+ system_info_html = locust .post (url = '/secure/admin/WebSudoAuthenticate.jspa' , data = auth_body ,
476
+ headers = {'X-Atlassian-Token' : 'no-check' }, catch_response = True )
477
+
471
478
472
479
def run_as_specific_user (username = None , password = None , do_websudo = False ):
473
480
if not (username and password ):
@@ -500,7 +507,7 @@ def wrapper(*args, **kwargs):
500
507
501
508
# send requests by the specific user
502
509
if app == JIRA or (app == JSM and app_type == TYPE_AGENT ):
503
- do_login_jira (locust , username , password )
510
+ do_login_jira (locust , username , password , do_websudo )
504
511
func (* args , ** kwargs )
505
512
do_login_jira (locust , session_user_name , session_user_password )
506
513
0 commit comments