|
83 | 83 |
|
84 | 84 | JIRA_TOKEN_PATTERN = r'name="atlassian-token" content="(.+?)">'
|
85 | 85 | CONFLUENCE_TOKEN_PATTERN = r'"ajs-atl-token" content="(.+?)"'
|
| 86 | +CONFLUENCE_KEYBOARD_HASH_RE = 'name=\"ajs-keyboardshortcut-hash\" content=\"(.*?)\">' |
| 87 | +CONFLUENCE_BUILD_NUMBER_RE = 'meta name=\"ajs-build-number\" content=\"(.*?)\"' |
86 | 88 |
|
87 | 89 | JIRA = 'jira'
|
88 | 90 | JSM = 'jsm'
|
@@ -389,6 +391,25 @@ def do_confluence_login(locust, usr, pwd):
|
389 | 391 | json=login_body,
|
390 | 392 | headers=headers,
|
391 | 393 | catch_response=True)
|
| 394 | + r = locust.get(url='/', catch_response=True) |
| 395 | + content = r.content.decode('utf-8') |
| 396 | + |
| 397 | + if 'Log Out' not in content: |
| 398 | + print(f'Login with {usr}, {pwd} failed: {content}') |
| 399 | + assert 'Log Out' in content, 'User authentication failed.' |
| 400 | + print(f'User {usr} is successfully logged in back') |
| 401 | + keyboard_hash = fetch_by_re(CONFLUENCE_KEYBOARD_HASH_RE, content) |
| 402 | + build_number = fetch_by_re(CONFLUENCE_BUILD_NUMBER_RE, content) |
| 403 | + token = fetch_by_re(locust.session_data_storage['token_pattern'], content) |
| 404 | + |
| 405 | + # 20 index.action |
| 406 | + locust.get('/index.action', catch_response=True) |
| 407 | + |
| 408 | + locust.session_data_storage['build_number'] = build_number |
| 409 | + locust.session_data_storage['keyboard_hash'] = keyboard_hash |
| 410 | + locust.session_data_storage['username'] = usr |
| 411 | + locust.session_data_storage['password'] = pwd |
| 412 | + locust.session_data_storage['token'] = token |
392 | 413 |
|
393 | 414 |
|
394 | 415 | def do_login_jira(locust, usr, pwd):
|
|
0 commit comments