diff --git a/buildtrigger/githubhandler.py b/buildtrigger/githubhandler.py index 1c2169e2d..d5ec45b73 100644 --- a/buildtrigger/githubhandler.py +++ b/buildtrigger/githubhandler.py @@ -310,7 +310,7 @@ class GithubBuildTrigger(BuildTriggerHandler): 'name': repo.name, 'full_name': repo.full_name, 'description': repo.description or '', - 'last_updated': timegm(repo.pushed_at.utctimetuple()), + 'last_updated': timegm(repo.pushed_at.utctimetuple()) if repo.pushed_at else 0, 'url': repo.html_url, 'has_admin_permissions': repo.permissions.admin, 'private': repo.private, diff --git a/buildtrigger/test/githubmock.py b/buildtrigger/test/githubmock.py index f42ec57ca..295956614 100644 --- a/buildtrigger/test/githubmock.py +++ b/buildtrigger/test/githubmock.py @@ -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()