def _convert_issues(self):
     return [
         convert_issue(redmine_issue, self.redmine_users_index,
                       self.attachments_index, self.gitlab_id,
                       self.gitlab_users_index, self.milestones_index)
         for redmine_issue in self.redmine_issues
     ]
 def test_closed_issue(self):
     redmine_issue = REDMINE_ISSUE_1732
     gitlab_issue, meta = convert_issue(redmine_issue,
                                        self.redmine_user_index, {}, '1',
                                        self.gitlab_users_idx, {}, True)
     self.assertEqual(
         gitlab_issue, {
             'title': '-RM-1732-MR-Update doc for v1',
             'description':
             'The doc is a bit old\n\n*(from redmine issue 1732 created on 2015-08-21, closed on 2015-09-09)*',
             'labels': 'From Redmine, Evolution, Urgent',
             'redmine_id': 1732,
             'assignee_id': JOHN['id'],
         })
     self.assertEqual(
         meta,
         {
             'sudo_user':
             JACK['username'],
             'attachments': [],
             'notes': [({
                 'body':
                 'Appliqué par commit '
                 'commit:66cbf9571ed501c6d38a5978f8a27e7b1aa35268.'
                 '\n\n*(from redmine: written on 2015-09-09)*'
             }, {
                 'sudo_user': '******'
             })
                       # empty notes should not be kept
                       ],
             'must_close':
             True
         })
    def test_open_issue(self):
        redmine_issue = REDMINE_ISSUE_1439
        milestone_index = {'v0.11': {'id': 3, 'title': 'v0.11'}}
        gitlab_issue, meta = convert_issue(redmine_issue,
                                           self.redmine_user_index, {}, '1',
                                           self.gitlab_users_idx,
                                           milestone_index, True)

        self.assertEqual(
            gitlab_issue, {
                'title': '-RM-1439-MR-Support SSL',
                'description':
                '\n\n*(from redmine issue 1439 created on 2015-04-03, relates #1430)*',
                'labels': 'From Redmine, Evolution, Normal',
                'redmine_id': 1439,
                'milestone_id': 3,
            })
        self.assertEqual(
            meta, {
                'sudo_user': JOHN['username'],
                'attachments': [],
                'notes': [],
                'must_close': False
            })