Exemplo n.º 1
0
 def test_init(self, mock_init, mock_nr_issues):
     """ Tests that the inner JiraFilter is initialized with correct parameters """
     mock_init.return_value = None
     backlog = JiraBacklog('url!', 'username!', 'password!', 'project!', 'unimportant')
     backlog.nr_user_stories()
     mock_nr_issues.assert_called_once()
     mock_init.assert_called_once_with('url!', 'username!', 'password!')
     self.assertEqual('Jira backlog', backlog.metric_source_name)
Exemplo n.º 2
0
 def test_nr_user_stories(self, mock_nr_issues):
     """ Tests that the function invokes correct default jql query. """
     mock_nr_issues.return_value = 1, ['a']
     backlog = JiraBacklog('url!', 'username!', 'password!', 'project!', 'unimportant')
     result = backlog.nr_user_stories()
     self.assertEqual((1, ['a']), result)
     mock_nr_issues.assert_called_once_with('project = "project!" AND type = Story')
Exemplo n.º 3
0
 def test_nr_user_stories_custom_filter_number(self, mock_nr_issues):
     """ Tests that the function invokes correct custom jira filter number instead of the query. """
     mock_nr_issues.return_value = 1, ['a']
     backlog = JiraBacklog('url!', 'username!', 'password!', 'whatever!?', 'unimportant',
                           jql_config={"nr_user_stories": [11, '12']})
     result = backlog.nr_user_stories()
     self.assertEqual((1, ['a']), result)
     mock_nr_issues.assert_called_once_with('11', '12')
Exemplo n.º 4
0
 def test_nr_user_stories_custom(self, mock_nr_issues):
     """ Tests that the function invokes correct custom jql query. """
     mock_nr_issues.return_value = 1, ['a']
     backlog = JiraBacklog('url!', 'username!', 'password!', 'project!', 'unimportant',
                           jql_config={"nr_user_stories": ['1st {project}', '2nd {project}']})
     result = backlog.nr_user_stories()
     self.assertEqual((1, ['a']), result)
     mock_nr_issues.assert_called_once_with('1st project!', '2nd project!')