예제 #1
0
 def test_transition_issue(self, mock_get_transition_id, mock_request):
     mock_get_transition_id.return_value = 1
     self.create_mock_request(mock_request)
     jira.transition_issue('TEST-1', 'Test Transition')
     mock_request.assert_called_once_with(
         "POST",
         f"{jira.SERVER}/rest/api/3/issue/TEST-1/transitions",
         data=json.dumps({"transition": {
             "id": 1
         }}),
         headers=jira.headers)
예제 #2
0
    def test_parent_status_transitioned_based_on_subtask_status(self):
        # Abe adds an issue to a sprint
        jira.add_issues_to_sprint(self.sprint_id, [self.issue_keys[0]])

        # Abe does a bunch of transitions on the subtasks, the parent issue
        # updates its status automatically
        parent = jira.get_issue(self.issue_keys[0])
        subtasks = parent['fields']['subtasks']
        jira.assign_issue(subtasks[0]['key'])
        jira.assign_issue(subtasks[1]['key'])
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "Backlog"
        ))

        jira.transition_issue(subtasks[0]['key'], "In Progress")
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "In Progress"
        ))

        jira.transition_issue(subtasks[0]['key'], "Archive", "Won't Do")
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "Backlog"
        ))

        jira.transition_issue(subtasks[0]['key'], "Done")
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "In Progress"
        ))

        jira.transition_issue(subtasks[1]['key'], "Done")
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "PO Review"
        ))

        jira.transition_issue(subtasks[1]['key'], "In Progress")
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "In Progress"
        ))

        # Abe backlogs the issue, the issue status goes back to "Backlog"
        jira.remove_issues_from_sprint([self.issue_keys[0]])
        self.wait_for(lambda: self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['status']['name'],
            "Backlog"
        ))
        self.assertEqual(
            jira.get_issue(self.issue_keys[0])['fields']['assignee'], None
        )
예제 #3
0
def set_story_status(story):
    current_story_status = story['fields']['status']['name']
    unique_subtask_statuses = list(
        set([
            subtask['fields']['status']['name']
            for subtask in story['fields']['subtasks']
        ]))
    if unique_subtask_statuses in ([], ['Backlog']):
        new_story_status = 'Backlog'
    elif unique_subtask_statuses == ['Done']:
        if current_story_status == 'Done':
            new_story_status = 'Done'
        else:
            new_story_status = 'PO Review'
    else:
        new_story_status = 'In Progress'
    if current_story_status != new_story_status:
        jira.transition_issue(story['key'], new_story_status)
예제 #4
0
    def test_burndown_delivered_to_slack(self):
        slack.clear_old_bot_messages(CHANNEL_ID, WEBHOOK_URL)

        # Abe adds some issues to a sprint with estimates. He then starts the
        # sprint. There is a notification in Slack with correct burndown number.
        parent = jira.get_issue(self.issue_keys[0])
        subtasks = parent['fields']['subtasks']
        jira.update_estimate(subtasks[0]['key'], 8)
        jira.transition_issue(subtasks[0]['key'], "Archive", "Won't Do")
        jira.update_estimate(subtasks[1]['key'], 20)
        parent = jira.get_issue(self.issue_keys[1])
        subtasks = parent['fields']['subtasks']
        jira.update_estimate(subtasks[0]['key'], 5)
        jira.update_estimate(subtasks[1]['key'], 2)
        jira.add_issues_to_sprint(self.sprint_id, self.issue_keys[:2])
        jira.start_sprint(self.sprint_id)
        message = slack.get_latest_bot_message(CHANNEL_ID, WEBHOOK_URL)
        self.assertIn('BURNDOWN', json.dumps(message))
        self.assertIn('27', json.dumps(message))
예제 #5
0
def set_backlog_parent_issue_status(issue):
    issue_status = issue['fields']['status']['name']
    if issue_status != "Backlog":
        jira.transition_issue(issue['key'], "Backlog")