def setUp(self):
     jira = FakeJiraFilter()
     self.__project = domain.Project(
         metric_sources={metric_source.ManualLogicalTestCaseTracker: jira},
         metric_source_ids={jira: '12345'})
     self.__metric = metric.DurationOfManualLogicalTestCases(
         subject=self.__project, project=self.__project)
 def test_report_without_jira(self):
     """ Test the metric report when no Jira filter has been configured. """
     self.assertEqual(
         'De uitvoeringstijd van handmatige logische testgevallen van <no name> kon niet gemeten '
         'worden omdat de bron ManualLogicalTestCaseTracker niet is geconfigureerd.',
         metric.DurationOfManualLogicalTestCases(domain.Project(),
                                                 domain.Project()).report())
    def test_value(self, issue_with_field_mock):
        """ Test that the value of the metric is the duration of the manual logical test cases. """
        jira_filter = metric_source.JiraFilter('http://jira/', 'username', 'password')
        issue_with_field_mock.return_value = [("issue1", 20), ("issue2", 60), ("issue3", 40)]
        self.__project = domain.Project(metric_sources={metric_source.ManualLogicalTestCaseTracker: jira_filter},
                                        metric_source_ids={jira_filter: '12345'})
        self.__metric = metric.DurationOfManualLogicalTestCases(subject=self.__project, project=self.__project)

        issue_with_field_mock.asses_called_once()
        self.assertEqual(120, self.__metric.value())