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:
parent
a427610a70
commit
4cb83283e9
|
@ -534,7 +534,7 @@ class RecordProcessor(object):
|
||||||
# present or the release date if no commit date is
|
# present or the release date if no commit date is
|
||||||
# present.
|
# present.
|
||||||
bug_fixed['date'] = (
|
bug_fixed['date'] = (
|
||||||
record['date_fix_committed'] or
|
record.get('date_fix_committed') or
|
||||||
record['date_fix_released']
|
record['date_fix_released']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -476,20 +476,17 @@ class TestRecordProcessor(testtools.TestCase):
|
||||||
self.assertRecordsMatch(expected_patch, records[1])
|
self.assertRecordsMatch(expected_patch, records[1])
|
||||||
self.assertRecordsMatch(expected_mark, records[2])
|
self.assertRecordsMatch(expected_mark, records[2])
|
||||||
|
|
||||||
def generate_bugs(self, assignee=None, date_fix_committed=None,
|
def generate_bugs(self, status='Confirmed', **kwargs):
|
||||||
date_fix_released=None,
|
rec = {
|
||||||
status='Confirmed'):
|
|
||||||
yield {
|
|
||||||
'record_type': 'bug',
|
'record_type': 'bug',
|
||||||
'id': 'bug_id',
|
'id': 'bug_id',
|
||||||
'owner': 'owner',
|
'owner': 'owner',
|
||||||
'assignee': assignee,
|
|
||||||
'date_created': 1234567890,
|
'date_created': 1234567890,
|
||||||
'date_fix_committed': date_fix_committed,
|
|
||||||
'date_fix_released': date_fix_released,
|
|
||||||
'module': 'nova',
|
'module': 'nova',
|
||||||
'status': status
|
'status': status
|
||||||
}
|
}
|
||||||
|
rec.update(kwargs)
|
||||||
|
yield rec
|
||||||
|
|
||||||
def test_process_bug_not_fixed(self):
|
def test_process_bug_not_fixed(self):
|
||||||
record = self.generate_bugs()
|
record = self.generate_bugs()
|
||||||
|
@ -546,7 +543,6 @@ class TestRecordProcessor(testtools.TestCase):
|
||||||
|
|
||||||
def test_process_bug_fix_released_without_committed(self):
|
def test_process_bug_fix_released_without_committed(self):
|
||||||
record = self.generate_bugs(status='Fix Released',
|
record = self.generate_bugs(status='Fix Released',
|
||||||
date_fix_committed=None,
|
|
||||||
date_fix_released=1234567892,
|
date_fix_released=1234567892,
|
||||||
assignee='assignee')
|
assignee='assignee')
|
||||||
record_processor_inst = self.make_record_processor()
|
record_processor_inst = self.make_record_processor()
|
||||||
|
|
Loading…
Reference in New Issue