def test_if_storypoints_can_be_retrieved_from_a_jira_issue(self): # Given self.jira_client.fields.return_value = DEFAULT_FIELDS_RETURN_VALUE mocked_jira_issue = MockedJiraIssue(story_points=100) mocked_jira_issue2 = MockedJiraIssue() mocked_jira_epic = MockedJiraIssue() mocked_jira_epic.key = "PROJ001-001" self.jira_client.search_issues.return_value = [ mocked_jira_issue2, mocked_jira_issue ] jat = JiraAgileToolBox(self.jira_client) # When result = jat.get_storypoints_from_epic(mocked_jira_epic) # Then self.jira_client.fields.assert_called_once() self.jira_client.search_issues.assert_called_with( "'Epic Link' = " + "PROJ001-001", fields=["customfield_10282", "status"], maxResults=0) self.assertEqual({"total": 100, "Reported": 100}, result)
def test_copy_fix_version_from_epic_to_all_items_in_epic(self): # Given sub_issue1 = MockedJiraIssue(story_points=0) version1 = Mock(spec=jira.resources.Version) version1.name = "JAT 0.0.9" epic = MockedJiraIssue() epic.fields.fixVersions = [version1] epic.key = "PROJ001-001" self.jira_client.search_issues.return_value = [sub_issue1] jat = JiraAgileToolBox(self.jira_client) # When jat.copy_fix_version_from_epic_to_all_items_in_epic(epic) # Then sub_issue1.add_field_value.assert_called_with("fixVersions", {"name": version1.name})
def test_copy_fix_version_from_epic_to_all_items_in_epic_searches_for_the_epic( self): # Given sub_issue1 = MockedJiraIssue(story_points=0) version1 = Mock(spec=jira.resources.Version) version1.name = "JAT 0.0.9" epic = MockedJiraIssue() epic.fields.fixVersions = [version1] epic.key = "PROJ001-001" self.jira_client.search_issues.return_value = [sub_issue1] jat = JiraAgileToolBox(self.jira_client) # When jat.copy_fix_version_from_epic_to_all_items_in_epic(epic) # Then self.jira_client.search_issues.assert_called_with( f"'Epic Link' = {epic.key}", fields=["fixVersions"], maxResults=0)