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

Commit

Permalink
Merge 48955f6 into 5d5399b
Browse files Browse the repository at this point in the history
  • Loading branch information
usize committed Apr 9, 2015
2 parents 5d5399b + 48955f6 commit 89d8666
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions relengapi/blueprints/clobberer/__init__.py
Expand Up @@ -27,6 +27,7 @@
from models import DB_DECLARATIVE_BASE

from relengapi import apimethod
from relengapi import p
from relengapi.lib import angular
from relengapi.lib import api

Expand All @@ -39,6 +40,8 @@
static_folder='static'
)

p.clobberer.clobber.doc('Submit clobber requests')

bp.root_widget_template('clobberer_root_widget.html', priority=100)

# prefix which denotes release builddirs
Expand Down Expand Up @@ -85,6 +88,7 @@ def _add_clobber(session, branch, builddir, slave=None):

@bp.route('/clobber', methods=['POST'])
@apimethod(None, body=[rest.ClobberRequest])
@p.clobberer.clobber.require()
def clobber(body):
"Request clobbers for particular branches and builddirs."
session = g.db.session(DB_DECLARATIVE_BASE)
Expand All @@ -101,6 +105,7 @@ def clobber(body):

@bp.route('/clobber/by-builder', methods=['POST'])
@apimethod(None, body=[rest.ClobberRequestByBuilder])
@p.clobberer.clobber.require()
def clobber_by_builder(body):
"""
Request clobbers for app builddirs associated with a particular buildername.
Expand Down
8 changes: 6 additions & 2 deletions relengapi/blueprints/clobberer/test_api.py
Expand Up @@ -9,6 +9,8 @@
from nose.tools import assert_greater
from nose.tools import eq_

from relengapi import p
from relengapi.lib import auth
from relengapi.lib.testing.context import TestContext

from . import BUILDDIR_REL_PREFIX
Expand All @@ -29,7 +31,9 @@
'slave': 'specific_slave',
}

test_context = TestContext(databases=[DB_DECLARATIVE_BASE], reuse_app=True)
auth_user = auth.HumanUser('winter2718@gmail.com')
auth_user._permissions = set([p.clobberer.clobber])
test_context = TestContext(databases=[DB_DECLARATIVE_BASE], reuse_app=True, user=auth_user)

_last_clobber_args = deepcopy(_clobber_args)
_last_clobber_args['buildername'] = 'buildername'
Expand Down Expand Up @@ -103,7 +107,7 @@ def test_lastclobber(client):
eq_(lastclobber_data[0], _last_clobber_args['builddir'])
eq_(lastclobber_data[1].isdigit(), True,
'lastclobber did not return a valid timestamp => {}'.format(lastclobber_data[1]))
eq_(lastclobber_data[2], 'anonymous',
eq_(lastclobber_data[2], 'winter2718@gmail.com',
'lastclobber did not return a valid username')

# Ensure a new build has been recorded matching the request args
Expand Down

0 comments on commit 89d8666

Please sign in to comment.