bodhi/controllers.py | 4 ++++ bodhi/tests/test_controllers.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+)
New commits: commit f5111b88c2f90c81e73f4b9d7b3f27414e370d35 Author: Luke Macken lmacken@redhat.com Date: Wed Jul 7 19:53:23 2010 -0400
Make the suggest_reboot flag actually configurable (#352)
diff --git a/bodhi/controllers.py b/bodhi/controllers.py index c602b0e..0627ebf 100644 --- a/bodhi/controllers.py +++ b/bodhi/controllers.py @@ -546,6 +546,7 @@ class Root(controllers.RootController): 'autokarma' : autokarma, 'stable_karma': stable_karma, 'unstable_karma': unstable_karma, + 'suggest_reboot': suggest_reboot, }
# Basic sanity checks @@ -769,6 +770,9 @@ class Root(controllers.RootController): # Update our ACL cache for this pkg package.committers = buildinfo[build]['people']
+ # Set the reboot suggested flag + package.suggest_reboot = suggest_reboot + # If new karma thresholds are specified, save them if not autokarma: stable_karma = unstable_karma = 0 diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py index 6b660ce..f3b7777 100644 --- a/bodhi/tests/test_controllers.py +++ b/bodhi/tests/test_controllers.py @@ -2063,3 +2063,40 @@ class TestControllers(testutil.DBTest): params['builds'], method='POST', headers=session) up = PackageUpdate.byTitle(params['builds']) assert up.karma == 3 + + def test_suggest_reboot(self): + session = login() + create_release() + params = { + 'builds' : 'TurboGears-1.0.8-1.fc7', + 'release' : 'Fedora 7', + 'type_' : 'security', + 'bugs' : '', + 'notes' : 'foobar', + 'request' : 'Stable', + 'suggest_reboot' : True, + 'autokarma' : True, + 'stable_karma' : 5, + 'unstable_karma' : -5 + } + self.save_update(params, session) + + # Ensure the flag gets set properly + assert PackageUpdate.byTitle(params['builds']).builds[0].package.suggest_reboot + + params = { + 'builds' : 'TurboGears-1.0.8-2.fc7', + 'release' : 'Fedora 7', + 'type_' : 'security', + 'bugs' : '', + 'notes' : 'foobar', + 'request' : 'Stable', + 'suggest_reboot': False, + 'autokarma' : True, + 'stable_karma' : 5, + 'unstable_karma' : -5 + } + self.save_update(params, session) + + # Ensure the flag gets unset properly + assert not PackageUpdate.byTitle(params['builds']).builds[0].package.suggest_reboot