def test_it_gets_tasks_from_manoderecha(self):
        raw_git_log = "\n".join((
            u"abcde}Some message}Sherlock Holmes}[email protected]",
            u"fghij}(md:123) Other message}John Watson}[email protected]",
            u"klmno}New message}Sherlock Holmes}[email protected]",
            u"pqrst}(md:456) Final message}John Watson}[email protected]",
        ))
        changelog = tokenize_git_log(raw_git_log)
        changelog = parse_labels(changelog)
        md = mock.Mock()
        md.get_tasks.return_value = [{'isActive': True}]
        tasks = get_tasks(changelog, md)
        assert tasks == md.get_tasks.return_value

        args, kwargs = md.get_tasks.call_args
        task_ids = args[0]
        assert set(['123', '456']) == set(task_ids)
 def test_it_returns_empty_list_for_empty_log(self):
     parsed = parse_labels([])
     assert len(parsed) == 0
 def test_it_parses_messages_with_gitlabels(self):
     with mock.patch('releases.remove_labels') as remove_labels:
         remove_labels.return_value = u"Message"
         parsed = parse_labels([{'message': 'Abc'}])
         assert parsed[0]['message'] == u"Message"
 def test_it_parses_labels_with_gitlabels(self):
     with mock.patch('releases.get_labels') as get_labels:
         get_labels.return_value = {'label': 'arg'}
         parsed = parse_labels([{'message': 'Abc'}])
         assert parsed[0]['labels'] == get_labels.return_value