Add ability for triggers to be disabled

Will be used in the followup commit to automatically disable broken triggers
This commit is contained in:
Joseph Schorr 2017-10-17 17:01:59 -04:00 committed by Joseph Schorr
parent 1e54a4d9e9
commit c35eec0615
18 changed files with 358 additions and 37 deletions

View file

@ -1,7 +1,8 @@
import pytest
from data import model
from endpoints.building import start_build, PreparedBuild, MaximumBuildsQueuedException
from endpoints.building import (start_build, PreparedBuild, MaximumBuildsQueuedException,
BuildTriggerDisabledException)
from test.fixtures import *
@ -29,3 +30,14 @@ def test_maximum_builds(app):
# Try to queue a second build; should fail.
with pytest.raises(MaximumBuildsQueuedException):
start_build(repo, prepared_build)
def test_start_build_disabled_trigger(app):
trigger = model.build.list_build_triggers('devtable', 'building')[0]
trigger.enabled = False
trigger.save()
build = PreparedBuild(trigger=trigger)
with pytest.raises(BuildTriggerDisabledException):
start_build(trigger.repository, build)