Fix failure when bug has no 'date_fix_committed' attr

Also fix unit test to catch the similar failures

Change-Id: I33092e6e89cd77d4707bb61f2877c58efc775398
This commit is contained in:
Ilya Shakhat 2015-12-15 15:02:02 +03:00
parent a427610a70
commit 4cb83283e9
2 changed files with 5 additions and 9 deletions

View File

@ -534,7 +534,7 @@ class RecordProcessor(object):
# present or the release date if no commit date is
# present.
bug_fixed['date'] = (
record['date_fix_committed'] or
record.get('date_fix_committed') or
record['date_fix_released']
)

View File

@ -476,20 +476,17 @@ class TestRecordProcessor(testtools.TestCase):
self.assertRecordsMatch(expected_patch, records[1])
self.assertRecordsMatch(expected_mark, records[2])
def generate_bugs(self, assignee=None, date_fix_committed=None,
date_fix_released=None,
status='Confirmed'):
yield {
def generate_bugs(self, status='Confirmed', **kwargs):
rec = {
'record_type': 'bug',
'id': 'bug_id',
'owner': 'owner',
'assignee': assignee,
'date_created': 1234567890,
'date_fix_committed': date_fix_committed,
'date_fix_released': date_fix_released,
'module': 'nova',
'status': status
}
rec.update(kwargs)
yield rec
def test_process_bug_not_fixed(self):
record = self.generate_bugs()
@ -546,7 +543,6 @@ class TestRecordProcessor(testtools.TestCase):
def test_process_bug_fix_released_without_committed(self):
record = self.generate_bugs(status='Fix Released',
date_fix_committed=None,
date_fix_released=1234567892,
assignee='assignee')
record_processor_inst = self.make_record_processor()