JiraV3ConvertCommentsToTable

This script is used to convert Jira comments to a table.

python · Atlassian Jira

Details

IDJiraV3ConvertCommentsToTable
Languagepython
From Version6.8.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section

README

This script is used to convert Jira comments to a table.

Script Data


Name Description
Script Type python3
Tags dynamic-section
Cortex XSOAR Version 6.8.0

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

CONTEXT_RESULTS = (
    '[{"Comment":"hello","Created":"2023-05-12T20:08:00.595+0300","Id":"18461","UpdateUser":"Tom Testman",'
    '"Updated":"2023-05-12T20:08:00.595+0300","User":"Tom Testman"}]'
)

EXPECTED_TABLE = (
    "|Comment|Created|Id|Update User|Updated|User|\n|---|---|---|---|---|---|\n"
    "| hello | 2023-05-12T20:08:00.595+0300 | 18461 | Tom Testman |"
    " 2023-05-12T20:08:00.595+0300 | Tom Testman |\n"
)


def test_convert_to_table():
    """
    Given:
        - A list of comments of a Jira issue in string format
    When:
        - Calling convert_to_table function
    Then:
        - Validate the table is created correctly
    """
    from JiraV3ConvertCommentsToTable import convert_to_table

    result = convert_to_table(CONTEXT_RESULTS)

    assert result.readable_output == EXPECTED_TABLE