Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

All clobbers endpoints #32

Merged
5 commits merged into from Feb 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion relengapi/blueprints/clobberer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,18 @@ def branches():
return [branch[0] for branch in branches]


@bp.route('/lastclobber/all', methods=['GET'])
@apimethod([rest.ClobberTime])
def lastclobber_all():
"Return a sorted list of all clobbers"
session = g.db.session(DB_DECLARATIVE_BASE)
return session.query(ClobberTime).order_by(ClobberTime.lastclobber)


@bp.route('/lastclobber/branch/by-builder/<string:branch>', methods=['GET'])
@apimethod({unicode: [rest.ClobberTime]}, unicode)
def lastclobber_by_builder(branch):
"Return a dictionary of most recent ClobberTimes grouped by buildername."

session = g.db.session(DB_DECLARATIVE_BASE)

# Isolates the maximum lastclobber for each builddir on a branch
Expand Down
8 changes: 8 additions & 0 deletions relengapi/blueprints/clobberer/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def test_clobber_request(client):
'No new clobbers were detected, clobber request failed.')


@ test_context
def test_lastclobber_all(client):
rv = client.get('/clobberer/lastclobber/all')
eq_(rv.status_code, 200)
clobbertimes = json.loads(rv.data)["result"]
eq_(len(clobbertimes), len(_clobber_args))


@test_context
def test_clobber_request_of_release(client):
"Ensures that attempting to clobber a release build will fail."
Expand Down