Skip to content

Commit

Permalink
Return only the latest four Jenkins builds (closes #15).
Browse files Browse the repository at this point in the history
  • Loading branch information
textbook committed Dec 13, 2016
1 parent f732577 commit d8da547
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flash_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .travis import TravisOS, TravisPro

__author__ = 'Jonathan Sharpe'
__version__ = '0.5.0'
__version__ = '0.5.1'

blueprint = Blueprint(
'services',
Expand Down
2 changes: 1 addition & 1 deletion flash_services/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def format_data(cls, data):
builds = [cls.format_build(build) for build in data['builds']]
estimate_time(builds)
return dict(
builds=builds,
builds=builds[:4],
health=health_summary(builds),
name=data['name'],
)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_jenkins_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ def test_estimated_formatting(_, __, service):
dict(duration=10000, description=None, timestamp=1481387964313, result='SUCCESS'),
dict(duration=10000, description=None, timestamp=1481387964313, result='SUCCESS'),
dict(duration=10000, description=None, timestamp=1481387964313, result='SUCCESS'),
dict(duration=10000, description=None, timestamp=1481387964313, result='SUCCESS'),
dict(duration=10000, description=None, timestamp=1481387964313, result='SUCCESS'),
])

result = service.format_data(response)

assert len(result['builds']) == 4
assert result['builds'][0] == dict(
author='<no author>',
duration=5,
Expand Down

0 comments on commit d8da547

Please sign in to comment.