def __init__(self, issue_entry): # Change these directly via __dict__ to avoid triggering __setattr_ below, # which would immediately mark issue dirty again. self.__dict__['_dirty'] = False self.__dict__['_changed'] = set() self.id = issue_entry.get('id') self.blocked_on = ChangeTrackingList( e['issueId'] for e in issue_entry.get('blockedOn', [])) self.blocking = ChangeTrackingList( e['issueId'] for e in issue_entry.get('blocking', [])) self.merged_into = issue_entry.get('mergedInto', {}).get('issueId') self.merged_into_project = (issue_entry.get('mergedInto', {}).get('projectId')) self.created = parseDateTime(issue_entry.get('published')) self.updated = parseDateTime(issue_entry.get('updated')) self.closed = parseDateTime(issue_entry.get('closed')) self.summary = issue_entry.get('summary') self.description = issue_entry.get('description') self.reporter = issue_entry.get('author', {}).get('name') self.owner = issue_entry.get('owner', {}).get('name') self.status = issue_entry.get('status') self.stars = issue_entry.get('stars') self.open = issue_entry.get('state') == 'open' self.labels = ChangeTrackingList(issue_entry.get('labels', [])) self.components = ChangeTrackingList(issue_entry.get('components', [])) self.cc = ChangeTrackingList( [e['name'] for e in issue_entry.get('cc', [])]) self.project_id = issue_entry.get('projectId') self.field_values = ChangeTrackingList([ CustomizedField.ConvertFromDict(field) for field in issue_entry.get('fieldValues', []) ]) self.setClean()
def __init__(self, comment_entry): self.author = comment_entry['author']['name'] self.comment = comment_entry['content'] self.created = parseDateTime(comment_entry['published']) self.id = comment_entry['id'] updates = comment_entry.get('updates', {}) self.owner = updates.get('owner') self.status = updates.get('status') self.merged_into = updates.get('mergedInto') self.cc = updates.get('cc', []) self.labels = updates.get('labels', []) self.components = updates.get('components', []) self.blocked_on = updates.get('blockedOn', []) self.blocking = updates.get('blocking', [])
def test_none_date(self): self.assertIsNone(parseDateTime(None))
def test_parses_date_without_microseconds(self): self.assertEquals(parseDateTime('2016-01-01T00:00:00'), datetime.datetime(2016, 1, 1, 0, 0, 0))