mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Renamed tests/tstutil.py to tests/util.py
This commit is contained in:
@@ -22,7 +22,7 @@ Test the `ipalib.backend` module.
|
||||
"""
|
||||
|
||||
from ipalib import backend, plugable, errors
|
||||
from tests.tstutil import ClassChecker
|
||||
from tests.util import ClassChecker
|
||||
|
||||
|
||||
class test_Backend(ClassChecker):
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Test the `ipalib.cli` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from tests.util import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from ipalib import cli, plugable
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Test the `ipalib.config` module.
|
||||
|
||||
import types
|
||||
|
||||
from tests.tstutil import raises
|
||||
from tests.util import raises
|
||||
from ipalib import config
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Test the `ipalib.crud` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import read_only, raises, ClassChecker
|
||||
from tests.util import read_only, raises, ClassChecker
|
||||
from ipalib import crud, frontend, plugable, config
|
||||
|
||||
def get_api():
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Test the `ipalib.errors` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises, ClassChecker
|
||||
from tests.util import raises, ClassChecker
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
Test the `ipalib.frontend` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from tests.tstutil import check_TypeError
|
||||
from tests.util import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from tests.util import check_TypeError
|
||||
from ipalib import frontend, backend, plugable, errors, ipa_types, config
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Test the `ipalib.ipa_types` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from tests.util import raises, getitem, no_set, no_del, read_only, ClassChecker
|
||||
from ipalib import ipa_types, errors, plugable
|
||||
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
Test the `ipalib.plugable` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises, no_set, no_del, read_only
|
||||
from tests.tstutil import getitem, setitem, delitem
|
||||
from tests.tstutil import ClassChecker
|
||||
from tests.util import raises, no_set, no_del, read_only
|
||||
from tests.util import getitem, setitem, delitem
|
||||
from tests.util import ClassChecker
|
||||
from ipalib import plugable, errors
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Test the `ipalib.util` module.
|
||||
"""
|
||||
|
||||
from tests.tstutil import raises
|
||||
from tests.util import raises
|
||||
from ipalib import util
|
||||
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
"""
|
||||
Test the `tests.tstutil` module.
|
||||
Test the `tests.util` module.
|
||||
"""
|
||||
|
||||
import tstutil
|
||||
import util
|
||||
|
||||
|
||||
class Prop(object):
|
||||
@@ -48,7 +48,7 @@ class Prop(object):
|
||||
|
||||
|
||||
def test_yes_raised():
|
||||
f = tstutil.raises
|
||||
f = util.raises
|
||||
|
||||
class SomeError(Exception):
|
||||
pass
|
||||
@@ -79,54 +79,54 @@ def test_yes_raised():
|
||||
raised = False
|
||||
try:
|
||||
f(SomeError, callback3)
|
||||
except tstutil.ExceptionNotRaised:
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
|
||||
def test_no_set():
|
||||
# Tests that it works when prop cannot be set:
|
||||
tstutil.no_set(Prop('get', 'del'), 'prop')
|
||||
util.no_set(Prop('get', 'del'), 'prop')
|
||||
|
||||
# Tests that ExceptionNotRaised is raised when prop *can* be set:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.no_set(Prop('set'), 'prop')
|
||||
except tstutil.ExceptionNotRaised:
|
||||
util.no_set(Prop('set'), 'prop')
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
|
||||
def test_no_del():
|
||||
# Tests that it works when prop cannot be deleted:
|
||||
tstutil.no_del(Prop('get', 'set'), 'prop')
|
||||
util.no_del(Prop('get', 'set'), 'prop')
|
||||
|
||||
# Tests that ExceptionNotRaised is raised when prop *can* be set:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.no_del(Prop('del'), 'prop')
|
||||
except tstutil.ExceptionNotRaised:
|
||||
util.no_del(Prop('del'), 'prop')
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
|
||||
def test_read_only():
|
||||
# Test that it works when prop is read only:
|
||||
assert tstutil.read_only(Prop('get'), 'prop') == 'prop value'
|
||||
assert util.read_only(Prop('get'), 'prop') == 'prop value'
|
||||
|
||||
# Test that ExceptionNotRaised is raised when prop can be set:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.read_only(Prop('get', 'set'), 'prop')
|
||||
except tstutil.ExceptionNotRaised:
|
||||
util.read_only(Prop('get', 'set'), 'prop')
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
# Test that ExceptionNotRaised is raised when prop can be deleted:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.read_only(Prop('get', 'del'), 'prop')
|
||||
except tstutil.ExceptionNotRaised:
|
||||
util.read_only(Prop('get', 'del'), 'prop')
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
@@ -134,15 +134,15 @@ def test_read_only():
|
||||
# deleted:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.read_only(Prop('get', 'del'), 'prop')
|
||||
except tstutil.ExceptionNotRaised:
|
||||
util.read_only(Prop('get', 'del'), 'prop')
|
||||
except util.ExceptionNotRaised:
|
||||
raised = True
|
||||
assert raised
|
||||
|
||||
# Test that AttributeError is raised when prop can't be read:
|
||||
raised = False
|
||||
try:
|
||||
tstutil.read_only(Prop(), 'prop')
|
||||
util.read_only(Prop(), 'prop')
|
||||
except AttributeError:
|
||||
raised = True
|
||||
assert raised
|
||||
Reference in New Issue
Block a user