def test_transition_new_issue_to_resolved_state_with_reso_in_restrictive_workflow(): """ transition a new issue to the Resolved state with a resolution in restrictive workflow """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Daytime TV spokesdroid says Be Sassy!"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Resolved", "Cannot Reproduce") issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert issue.Resolution == "Cannot Reproduce" jp.transitionIssueState(issue_key, "Reopened") issue = jp.getIssue(issue_key) assert issue.Status == "Reopened" jp.transitionIssueState(issue_key, "Closed", "Fixed") # for ON_DEMAND issue = jp.getIssue(issue_key) assert issue.Status == "Closed" jp.transitionIssueState(issue_key, "Reopened") issue = jp.getIssue(issue_key) assert issue.Status == "Reopened" jp.transitionIssueState(issue_key, "Resolved") issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert jp.deleteIssue(issue_key)
def test_transition_bug_to_resolved_state(): """ transition an ON_DEMAND instance Bug in the 'RW' project to Resolved """ """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Benkmeister Fullmore writez stuff"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Released", "Done" ) issue = jp.getIssue(issue_key) assert issue.Status == "Released" assert issue.Resolution == "Done" assert jp.deleteIssue(issue_key) """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Benkmeister Fullmore writez stuff"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Resolved", "Done" ) issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert issue.Resolution == "Done" assert jp.deleteIssue(issue_key)
def test_transition_new_issue_to_Closed_state_without_resolution_in_restrictive_workflow(): """ transition a new issue to Closed state without a resolution in restrictive workflow """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Your life is an insult to the galaxy", "Priority" : "Highest"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Closed") issue = jp.getIssue(issue_key) assert issue.Status == "Closed" assert jp.deleteIssue(issue_key)
def test_transition_new_issue_to_resolved_state_without_resolution_in_restrictive_workflow(): """ transition a new issue to Resolved state without a resolution in restrictive workflow """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Don't be sassy with me!"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Resolved") issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert issue.Resolution is None assert jp.deleteIssue(issue_key)
def test_transition_newly_created_issue_to_resolved_state_with_a_resolution(): """ transition a newly created issue to the Resolved state with a resolution """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point"} issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item) jp.transitionIssueState(issue_key, "Done") issue = jp.getIssue(issue_key) assert issue.Status == "Done" assert issue.Resolution == "Done" assert jp.deleteIssue(issue_key)
def test_transition_newly_created_issue_to_closed_state_in_restricted_workflow(): """ transition a newly created issue to the Closed state in restricted workflow """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Hand Grenades and horseshoes"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Closed", "Won't Do") issue = jp.getIssue(issue_key) assert issue.Status == "Closed" assert issue.Resolution == "Won't Do" assert jp.deleteIssue(issue_key)
def test_error_on_attempt_to_transition_new_issue_to_in_progress_state_with_a_resolution(): """ error out on an attempt transition a newly created issue to the In Progress state with a resolution """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point"} issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item) with py.test.raises(JiraProxyError) as excinfo: jp.transitionIssueState(issue_key, "In Progress", "Won't Do") actualErrorMessage = excErrorMessage(excinfo) assert 'resolution' in actualErrorMessage assert jp.deleteIssue(issue_key)
def disable_test_resolution_attribute_uses_display_name_when_configured_to_use_custom_restrictive_workflow(): """ Resolution attribute uses Display Name when Jira is configured to use a custom workflow that is more restrictive than the simplified default workflow """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster scream tester"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Resolved", "Won't Do" ) issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert issue.Resolution == "Won't Do" assert jp.deleteIssue(issue_key)
def test_transition_newly_created_issue_to_in_progress_state(): """ transition a newly created issue to the In Progress state """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point"} issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item) # If the PROJECT_KEY_4 is used the following line would work #assert "Start Progress" in transitions.keys() jp.transitionIssueState(issue_key, "In Progress") issue = jp.getIssue(issue_key) assert issue.Status == "In Progress" assert jp.deleteIssue(issue_key)
def test_error_on_attempt_to_transition_new_issue_to_in_progress_state_with_invalid_resolution(): """ error out on an attempt transition a newly created issue to the In Progress state with an invalid resolution """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster Speed Test"} issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item) with py.test.raises(JiraProxyError) as excinfo: jp.transitionIssueState(issue_key, "Done", "Too Slow") actualErrorMessage = excErrorMessage(excinfo) assert "'resolution' cannot be set. It is not on the appropriate screen, or unknown" in actualErrorMessage assert 'proposed Resolution value |Too Slow|' in actualErrorMessage assert jp.deleteIssue(issue_key)
def test_transition_previously_created_new_feature_issue_to_other_states_with_a_resolution_for_appropriate_states( ): """ transition a newly created issue through many states """ jp = JiraProxy(VANILLA_SERVER_REGULAR_USER_CONFIG) status_items = jp.getStatuses(VANILLA_SERVER_REGULAR_USER_CONFIG) #print("\nStatus values for the NFI project") #for status in status_items: # print(f'... {status}') nf_item = jp.getIssue(STATIC_NEW_FEATURE_ITEM) #print(f"Current state: {nf_item.Status} Resolution: |{nf_item.Resolution}|") transitions = jp.getTransitions(nf_item.key) #for next_state, trans_info in transitions.items(): # print(next_state, trans_info) #print(f"\n {nf_item.key} Status Transitions:") for new_state in expected_results: #print(f'Updating current status {nf_item.Status} to {new_state}') if nf_item.Status == new_state: #print(f'... skipping status update, new_status same as current status {nf_item.Status}') continue nf_item = jp.transitionIssueState(nf_item.key, new_state, resolution=None) #print(f'... transitioned Issue.Status is now {nf_item.Status}') assert nf_item.Status == new_state
def test_transition_issue_to_done_state_and_wont_do_resolution(): """ transition issue to Done status and Won't Do resolution """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point", "Resolution" : "Won't Do"} issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item) jp.transitionIssueState(issue_key,"Done" ) issue = jp.getIssue(issue_key) assert issue.Status == "Done" assert issue.Resolution == "Done" issue.Resolution = "Won't Do" success = jp.updateIssue(issue) if success: issue = jp.getIssue(issue.key) assert issue.Resolution == "Won't Do" assert jp.deleteIssue(issue_key)
def test_transition_bug_to_Closed_state(): """ transition an ON_DEMAND instance Bug in the 'RW' project to Closed """ """ jp = JiraProxy(GOOD_VANILLA_SERVER_DEV_USER_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Resolved", "Won't Fix" ) issue = jp.getIssue(issue_key) assert issue.Status == "Resolved" assert issue.Resolution == "Won't Fix" assert jp.deleteIssue(issue_key) """ jp = JiraProxy(GOOD_VANILLA_ONDEMAND_CONFIG) work_item = {"Summary" : "Roller Coaster assembly point"} issue_key = jp.createIssue(PROJECT_KEY_4, "Bug", work_item) jp.transitionIssueState(issue_key, "Closed", "Won't Do" ) issue = jp.getIssue(issue_key) assert issue.Status == "Closed" assert issue.Resolution == "Won't Do" assert jp.deleteIssue(issue_key)
def main(args): target_issue, new_status = args[:2] jira = JiraProxy(REG_USER_CONFIG) issue = jira.getIssue(target_issue) upd_issue = jira.transitionIssueState(target_issue, 'To Do', resolution='In Review') #issue = jira.getIssue(issue_key) #desc, created, updated = [issue[attr_name] for attr_name in ["Description", "Created", "Updated"]] #print(f'{issue_key:<10} : {desc:<20} : {created:<23.23} : {updated:<23.23}') print(upd_issue.brief())
def main(args): if len(args) != 2: sys.stderr.write("ERROR: The Jira issue key and desired Status value must be provided\n") sys.exit(1) issue_key, new_status = args config_file = CONFIG_FILE_NAME if not os.path.exists(config_file): sys.stderr.write(f"ERROR: The target config file '{config_file}' is not present in the current directory\n") sys.exit(2) jirpa_config = inhaleConfig(config_file) jp = JiraProxy(jirpa_config) log_file = config_file.replace('.cfg', '.log') actvy_logger = ActivityLogger(log_file) actvy_logger.setLevel('INFO') jp.logger = actvy_logger actvy_logger.info(f'jirpa version is {".".join(map(str, jirpa.__version__))}') try: issue = jp.getIssue(issue_key) except Exception as exc: print(f'Unable to retrieve issue for {issue_key}, {str(exc)}') sys.exit(4) print(f'{issue.key} has current Status value of |{issue.Status}|') actvy_logger.info(f'For project: {jirpa_config["project"]} issuetype: {jirpa_config["issuetype"]} the Status values are --> {" ".join(jp.status_values)}') if new_status not in jp.status_values: print(f'Intended new status value of |{new_status}| is not a valid Status value for the {jirpa_config["project"]} Project') sys.exit(5) if issue.Status == new_status: print(f'{issue.key} current Status value |{issue.Status}| already matches the intended value of |{new_status}|, no action taken') sys.exit(6) actvy_logger.setLevel('DEBUG') try: upd_issue = jp.transitionIssueState(issue_key, new_status) except Exception as exc: print(f'Unable to transition {issue_key} Status to |{new_status}|, {str(exc)}') sys.exit(4) if upd_issue: print(f'{issue_key} has updated Status value of |{upd_issue.Status}|') else: print(f'call to transitionIssueState did not return a value')
def main(args): jira = JiraProxy(REG_USER_CONFIG) ## Create Epic issue_attributes = { #"Epic Name" : "Formentus Juva", #"Summary" : "In the infinite energetic unspeck of the pre-cataclysm", "Epic Name": "Dykolvut Tiskolid", "Summary": "Too many Beeelllliions in the digipay system", "Description": "Immense and unimaginable angst was burst forth upon the proto-void", } issue_key = jira.createIssue(PROJECT_KEY, "Epic", issue_attributes) # returns an issue key ## Read the Epic issue = jira.getIssue(issue_key) status = issue.Status print(f"Issue : {issue.key}") print(issue.brief()) print("") print("-" * 60) print(f'{"Key":<22} : {"Value"}') print("--------------- ----------") values = issue.attributeValues() for attribute_name, value in values: print(f'{attribute_name:<20} : {value}') print("") ## Update the Epic issue.Description = 'Unhound the barkulop hinderys' issue.Status = 'Done' issue.Assignee = 'devuser' jira.updateIssue(issue) upd_issue = jira.transitionIssueState(issue.key, 'Done') print(issue.brief()) ## Delete the Epic jira.deleteIssue(upd_issue.key) print(f'{issue.key} was deleted')