Fix NoneType error in GH trigger when it has no pushed_at field

This appears to occur in new repositories that have not yet been pushed.

Fixes 234686591/
This commit is contained in:
Joseph Schorr 2017-03-20 18:14:50 -04:00
parent 4bee4dbfff
commit 4cb8412fd8
2 changed files with 7 additions and 2 deletions

View file

@ -53,7 +53,12 @@ def get_mock_github():
repo_mock.full_name = '%s/%s' % (namespace, name)
repo_mock.name = name
repo_mock.description = 'some %s repo' % (name)
repo_mock.pushed_at = datetime.utcfromtimestamp(0)
if name != 'anotherrepo':
repo_mock.pushed_at = datetime.utcfromtimestamp(0)
else:
repo_mock.pushed_at = None
repo_mock.html_url = 'https://bitbucket.org/%s/%s' % (namespace, name)
repo_mock.private = name == 'somerepo'
repo_mock.permissions = Mock()