How to use the locustio.common_utils.jira_measure function in locustio

To help you get started, we’ve selected a few locustio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def browse_boards(locust):
    params = BrowseBoards()
    locust.client.get('/secure/ManageRapidViews.jspa', catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1205"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1210"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1215"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1225"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.get(f'/rest/greenhopper/1.0/rapidviews/viewsData?_{timestamp_int()}', catch_response=True)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def browse_projects(locust):
    params = BrowseProjects()

    page = random.randint(1, jira_dataset['pages'])
    r = locust.client.get(f'/secure/BrowseProjects.jspa?selectedCategory=all&selectedProjectType=all&page={page}',
                          catch_response=True)
    content = r.content.decode('utf-8')
    if not ('WRM._unparsedData["com.atlassian.jira.project.browse:projects"]="' in content):
        logger.error(f'Could not browse projects: {content}')
    assert 'WRM._unparsedData["com.atlassian.jira.project.browse:projects"]="' in content, 'Could not browse projects'
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("905"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("910"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("920"),
                       TEXT_HEADERS, catch_response=True)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def view_project_summary(locust):
    params = ViewProjectSummary()
    project = random.choice(jira_dataset['projects'])
    project_key = project[0]

    r = locust.client.get(f'/projects/{project_key}/summary', catch_response=True)
    content = r.content.decode('utf-8')
    logger.locust_info(f"{params.action_name}. View project {project_key}: {content}")

    assert_string = f'["project-key"]="\\"{project_key}\\"'
    if not (assert_string in content):
        logger.error(f'{params.err_message} {project_key}')
    assert assert_string in content, params.err_message

    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("505"),
                       TEXT_HEADERS, catch_response=True)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def view_kanban_board(locust):
    kanban_board_id = random.choice(jira_dataset["kanban_boards"])[0]
    view_board(locust, kanban_board_id)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
    @jira_measure
    def edit_issue_open_editor():
        r = locust.client.get(f'/secure/EditIssue!default.jspa?id={issue_id}', catch_response=True)
        content = r.content.decode('utf-8')

        issue_type = fetch_by_re(params.issue_type_pattern, content)
        atl_token = fetch_by_re(params.atl_token_pattern, content)
        priority = fetch_by_re(params.issue_priority_pattern, content, group_no=2)
        assignee = fetch_by_re(params.issue_assigneee_reporter_pattern, content, group_no=2)
        reporter = fetch_by_re(params.issue_reporter_pattern, content)

        if not (f' Edit Issue:  [{issue_key}]' in content):
            logger.error(f'{params.err_message_issue_not_found} - {issue_id}, {issue_key}: {content}')
        assert f' Edit Issue:  [{issue_key}]' in content, \
            params.err_message_issue_not_found
        logger.locust_info(f"{params.action_name}: Editing issue {issue_key}")
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
    @jira_measure
    def create_issue_open_quick_create():
        r = locust.client.post('/secure/QuickCreateIssue!default.jspa?decorator=none',
                               ADMIN_HEADERS, catch_response=True)
        content = r.content.decode('utf-8')
        atl_token = fetch_by_re(params.atl_token_pattern, content)
        form_token = fetch_by_re(params.form_token_pattern, content)
        issue_type = fetch_by_re(params.issue_type_pattern, content)
        resolution_done = fetch_by_re(params.resolution_done_pattern, content)
        fields_to_retain = re.findall(params.fields_to_retain_pattern, content)
        custom_fields_to_retain = re.findall(params.custom_fields_to_retain_pattern, content)

        issue_body_params_dict = {'atl_token': atl_token,
                                  'form_token': form_token,
                                  'issue_type': issue_type,
                                  'project_id': project_id,
                                  'resolution_done': resolution_done,
github atlassian / dc-app-performance-toolkit / app / extension / jira / extension_locust.py View on Github external
@jira_measure
def app_specific_action(locust):
    r = locust.client.get('/plugin/report')  # navigate to page

    content = r.content.decode('utf-8')  # parse page content
    token_pattern_example = '"token":"(.+?)"'
    id_pattern_example = '"id":"(.+?)"'
    token = re.findall(token_pattern_example, content)  # parse variables from response using regexp
    id = re.findall(id_pattern_example, content)
    logger.locust_info(f'token: {token}, id: {id}')  # logger for debug when verbose is true in jira.yml file
    if 'assertion string' not in content:
        logger.error(f"'assertion string' was not found in {content}")
    assert 'assertion string' in content  # assertion after GET request

    body = {"id": id, "token": token}  # include parsed variables to POST body
    headers = {'content-type': 'application/json'}
    r = locust.client.post('/plugin/post/endpoint', body, headers)  # send some POST request
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def view_scrum_board(locust):
    scrum_board_id = random.choice(jira_dataset["scrum_boards"])[0]
    view_board(locust, scrum_board_id)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
    @jira_measure
    def add_comment_save_comment():
        r = locust.client.post(f'/secure/AddComment.jspa?atl_token={locust.storage["token"]}',
                               params={"id": {issue_id}, "formToken": locust.storage["form_token"],
                                       "dnd-dropzone": None, "comment": generate_random_string(20),
                                       "commentLevel": None, "atl_token": locust.storage["token"],
                                       "Add": "Add"}, headers=TEXT_HEADERS, catch_response=True)
        content = r.content.decode('utf-8')
        if not (f'' in content):
            logger.error(f'Could not save comment: {content}')
        assert f'' in content, 'Could not save comment'
    add_comment_save_comment()
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
@jira_measure
def login_and_view_dashboard(locust):
    params = Login()

    user = random.choice(jira_dataset["users"])
    body = params.login_body
    body['os_username'] = user[0]
    body['os_password'] = user[1]

    locust.client.post('/login.jsp', body, TEXT_HEADERS, catch_response=True)
    r = locust.client.get('/', catch_response=True)
    if not r.content:
        raise Exception('Please check server hostname in jira.yml file')
    content = r.content.decode('utf-8')
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("110"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post("/plugins/servlet/gadgets/dashboard-diagnostics",