diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-03-09 09:41:16 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-03-19 16:33:35 +0100 |
commit | c14a2d824557b06fd20bac77ddfc9e09001e2a92 (patch) | |
tree | 0f8f012dc47ab7ecb8574a53eeeba12706edc336 /tests/test_install | |
parent | 35521ad6bb92057d5faefa2059d7d800bebb1af0 (diff) | |
download | freeipa-c14a2d824557b06fd20bac77ddfc9e09001e2a92.tar.gz freeipa-c14a2d824557b06fd20bac77ddfc9e09001e2a92.tar.xz freeipa-c14a2d824557b06fd20bac77ddfc9e09001e2a92.zip |
Use nose tools to check for exceptions
Some of our tests checked for exceptions using an error-prone
try block: they allowed the expected exception to pass, but sometimes
forgot an else block, so the test passed when an exception wasn't
thrown.
This changes the tests to use the appropriate nose tools (raises,
assert_raises).
For consistency, tests that had a correct else block are also changed.
Also fix some test problems that were hidden by the above:
- in some sudorule and HBAC tests, change the *_add_user argument name
from `users` to `user`
- don't remove HBAC testing data while it was still used
Diffstat (limited to 'tests/test_install')
-rw-r--r-- | tests/test_install/test_updates.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/test_install/test_updates.py b/tests/test_install/test_updates.py index eb376f191..8b9ac28eb 100644 --- a/tests/test_install/test_updates.py +++ b/tests/test_install/test_updates.py @@ -24,7 +24,8 @@ import os import sys import ldap import nose -from tests.util import raises, PluginTester +from nose.tools import raises +from tests.util import PluginTester from tests.data import unicode_str from ipalib import api from ipalib import errors @@ -182,20 +183,16 @@ class test_update(object): assert(modified == True) + @raises(BadSyntax) def test_8_badsyntax(self): """ Test the updater with an unknown keyword """ - try: - modified = self.updater.update([self.testdir + "8_badsyntax.update"]) - except BadSyntax: - pass + modified = self.updater.update([self.testdir + "8_badsyntax.update"]) + @raises(BadSyntax) def test_9_badsyntax(self): """ Test the updater with an incomplete line """ - try: - modified = self.updater.update([self.testdir + "9_badsyntax.update"]) - except BadSyntax: - pass + modified = self.updater.update([self.testdir + "9_badsyntax.update"]) |