mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Rename errors2.py to errors.py. Modify all affected files.
This commit is contained in:
committed by
Rob Crittenden
parent
596d410471
commit
7d0bd4b895
@@ -26,7 +26,7 @@ from tests.util import ClassChecker, raises, create_test_api
|
||||
from tests.data import unicode_str
|
||||
from ipalib.request import context, Connection
|
||||
from ipalib.frontend import Command
|
||||
from ipalib import backend, plugable, errors2, base
|
||||
from ipalib import backend, plugable, errors, base
|
||||
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class test_Executioner(ClassChecker):
|
||||
|
||||
class good(Command):
|
||||
def execute(self):
|
||||
raise errors2.ValidationError(
|
||||
raise errors.ValidationError(
|
||||
name='nurse',
|
||||
error=u'Not naughty!',
|
||||
)
|
||||
@@ -209,7 +209,7 @@ class test_Executioner(ClassChecker):
|
||||
# Test that CommandError is raised:
|
||||
conn = Connection('The connection.', Disconnect())
|
||||
context.someconn = conn
|
||||
e = raises(errors2.CommandError, o.execute, 'nope')
|
||||
e = raises(errors.CommandError, o.execute, 'nope')
|
||||
assert e.name == 'nope'
|
||||
assert conn.disconnect.called is True # Make sure destroy_context() was called
|
||||
assert context.__dict__.keys() == []
|
||||
@@ -235,7 +235,7 @@ class test_Executioner(ClassChecker):
|
||||
# Test with good command:
|
||||
conn = Connection('The connection.', Disconnect())
|
||||
context.someconn = conn
|
||||
e = raises(errors2.ValidationError, o.execute, 'good')
|
||||
e = raises(errors.ValidationError, o.execute, 'good')
|
||||
assert e.name == 'nurse'
|
||||
assert e.error == u'Not naughty!'
|
||||
assert conn.disconnect.called is True # Make sure destroy_context() was called
|
||||
@@ -244,7 +244,7 @@ class test_Executioner(ClassChecker):
|
||||
# Test with bad command:
|
||||
conn = Connection('The connection.', Disconnect())
|
||||
context.someconn = conn
|
||||
e = raises(errors2.InternalError, o.execute, 'bad')
|
||||
e = raises(errors.InternalError, o.execute, 'bad')
|
||||
assert conn.disconnect.called is True # Make sure destroy_context() was called
|
||||
assert context.__dict__.keys() == []
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
"""
|
||||
Test the `ipalib.error2` module.
|
||||
Test the `ipalib.errors` module.
|
||||
"""
|
||||
|
||||
import re
|
||||
import inspect
|
||||
from tests.util import assert_equal, raises, dummy_ugettext
|
||||
from ipalib import errors2, request
|
||||
from ipalib import errors, request
|
||||
from ipalib.constants import TYPE_ERROR
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ class PrivateExceptionTester(object):
|
||||
if self.__klass is None:
|
||||
self.__klass = self._klass
|
||||
assert issubclass(self.__klass, StandardError)
|
||||
assert issubclass(self.__klass, errors2.PrivateError)
|
||||
assert not issubclass(self.__klass, errors2.PublicError)
|
||||
assert issubclass(self.__klass, errors.PrivateError)
|
||||
assert not issubclass(self.__klass, errors.PublicError)
|
||||
return self.__klass
|
||||
klass = property(__get_klass)
|
||||
|
||||
@@ -46,9 +46,9 @@ class PrivateExceptionTester(object):
|
||||
assert not hasattr(self.klass, key), key
|
||||
inst = self.klass(**kw)
|
||||
assert isinstance(inst, StandardError)
|
||||
assert isinstance(inst, errors2.PrivateError)
|
||||
assert isinstance(inst, errors.PrivateError)
|
||||
assert isinstance(inst, self.klass)
|
||||
assert not isinstance(inst, errors2.PublicError)
|
||||
assert not isinstance(inst, errors.PublicError)
|
||||
for (key, value) in kw.iteritems():
|
||||
assert getattr(inst, key) is value
|
||||
assert str(inst) == self.klass.format % kw
|
||||
@@ -58,13 +58,13 @@ class PrivateExceptionTester(object):
|
||||
|
||||
class test_PrivateError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PrivateError` exception.
|
||||
Test the `ipalib.errors.PrivateError` exception.
|
||||
"""
|
||||
_klass = errors2.PrivateError
|
||||
_klass = errors.PrivateError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PrivateError.__init__` method.
|
||||
Test the `ipalib.errors.PrivateError.__init__` method.
|
||||
"""
|
||||
inst = self.klass(key1='Value 1', key2='Value 2')
|
||||
assert inst.key1 == 'Value 1'
|
||||
@@ -92,14 +92,14 @@ class test_PrivateError(PrivateExceptionTester):
|
||||
|
||||
class test_SubprocessError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.SubprocessError` exception.
|
||||
Test the `ipalib.errors.SubprocessError` exception.
|
||||
"""
|
||||
|
||||
_klass = errors2.SubprocessError
|
||||
_klass = errors.SubprocessError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.SubprocessError.__init__` method.
|
||||
Test the `ipalib.errors.SubprocessError.__init__` method.
|
||||
"""
|
||||
inst = self.new(returncode=1, argv=('/bin/false',))
|
||||
assert inst.returncode == 1
|
||||
@@ -110,14 +110,14 @@ class test_SubprocessError(PrivateExceptionTester):
|
||||
|
||||
class test_PluginSubclassError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginSubclassError` exception.
|
||||
Test the `ipalib.errors.PluginSubclassError` exception.
|
||||
"""
|
||||
|
||||
_klass = errors2.PluginSubclassError
|
||||
_klass = errors.PluginSubclassError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginSubclassError.__init__` method.
|
||||
Test the `ipalib.errors.PluginSubclassError.__init__` method.
|
||||
"""
|
||||
inst = self.new(plugin='bad', bases=('base1', 'base2'))
|
||||
assert inst.plugin == 'bad'
|
||||
@@ -129,14 +129,14 @@ class test_PluginSubclassError(PrivateExceptionTester):
|
||||
|
||||
class test_PluginDuplicateError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginDuplicateError` exception.
|
||||
Test the `ipalib.errors.PluginDuplicateError` exception.
|
||||
"""
|
||||
|
||||
_klass = errors2.PluginDuplicateError
|
||||
_klass = errors.PluginDuplicateError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginDuplicateError.__init__` method.
|
||||
Test the `ipalib.errors.PluginDuplicateError.__init__` method.
|
||||
"""
|
||||
inst = self.new(plugin='my_plugin')
|
||||
assert inst.plugin == 'my_plugin'
|
||||
@@ -146,14 +146,14 @@ class test_PluginDuplicateError(PrivateExceptionTester):
|
||||
|
||||
class test_PluginOverrideError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginOverrideError` exception.
|
||||
Test the `ipalib.errors.PluginOverrideError` exception.
|
||||
"""
|
||||
|
||||
_klass = errors2.PluginOverrideError
|
||||
_klass = errors.PluginOverrideError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginOverrideError.__init__` method.
|
||||
Test the `ipalib.errors.PluginOverrideError.__init__` method.
|
||||
"""
|
||||
inst = self.new(base='Base', name='cmd', plugin='my_cmd')
|
||||
assert inst.base == 'Base'
|
||||
@@ -165,14 +165,14 @@ class test_PluginOverrideError(PrivateExceptionTester):
|
||||
|
||||
class test_PluginMissingOverrideError(PrivateExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginMissingOverrideError` exception.
|
||||
Test the `ipalib.errors.PluginMissingOverrideError` exception.
|
||||
"""
|
||||
|
||||
_klass = errors2.PluginMissingOverrideError
|
||||
_klass = errors.PluginMissingOverrideError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PluginMissingOverrideError.__init__` method.
|
||||
Test the `ipalib.errors.PluginMissingOverrideError.__init__` method.
|
||||
"""
|
||||
inst = self.new(base='Base', name='cmd', plugin='my_cmd')
|
||||
assert inst.base == 'Base'
|
||||
@@ -194,8 +194,8 @@ class PublicExceptionTester(object):
|
||||
if self.__klass is None:
|
||||
self.__klass = self._klass
|
||||
assert issubclass(self.__klass, StandardError)
|
||||
assert issubclass(self.__klass, errors2.PublicError)
|
||||
assert not issubclass(self.__klass, errors2.PrivateError)
|
||||
assert issubclass(self.__klass, errors.PublicError)
|
||||
assert not issubclass(self.__klass, errors.PrivateError)
|
||||
assert type(self.__klass.errno) is int
|
||||
assert 900 <= self.__klass.errno <= 5999
|
||||
return self.__klass
|
||||
@@ -211,9 +211,9 @@ class PublicExceptionTester(object):
|
||||
assert not hasattr(self.klass, key), key
|
||||
inst = self.klass(format=format, message=message, **kw)
|
||||
assert isinstance(inst, StandardError)
|
||||
assert isinstance(inst, errors2.PublicError)
|
||||
assert isinstance(inst, errors.PublicError)
|
||||
assert isinstance(inst, self.klass)
|
||||
assert not isinstance(inst, errors2.PrivateError)
|
||||
assert not isinstance(inst, errors.PrivateError)
|
||||
for (key, value) in kw.iteritems():
|
||||
assert getattr(inst, key) is value
|
||||
return inst
|
||||
@@ -221,13 +221,13 @@ class PublicExceptionTester(object):
|
||||
|
||||
class test_PublicError(PublicExceptionTester):
|
||||
"""
|
||||
Test the `ipalib.errors2.PublicError` exception.
|
||||
Test the `ipalib.errors.PublicError` exception.
|
||||
"""
|
||||
_klass = errors2.PublicError
|
||||
_klass = errors.PublicError
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
Test the `ipalib.errors2.PublicError.__init__` method.
|
||||
Test the `ipalib.errors.PublicError.__init__` method.
|
||||
"""
|
||||
context = request.context
|
||||
message = u'The translated, interpolated message'
|
||||
@@ -347,13 +347,13 @@ class test_PublicError(PublicExceptionTester):
|
||||
|
||||
def test_public_errors():
|
||||
"""
|
||||
Test the `ipalib.errors2.public_errors` module variable.
|
||||
Test the `ipalib.errors.public_errors` module variable.
|
||||
"""
|
||||
i = 0
|
||||
for klass in errors2.public_errors:
|
||||
for klass in errors.public_errors:
|
||||
assert issubclass(klass, StandardError)
|
||||
assert issubclass(klass, errors2.PublicError)
|
||||
assert not issubclass(klass, errors2.PrivateError)
|
||||
assert issubclass(klass, errors.PublicError)
|
||||
assert not issubclass(klass, errors.PrivateError)
|
||||
assert type(klass.errno) is int
|
||||
assert 900 <= klass.errno <= 5999
|
||||
doc = inspect.getdoc(klass)
|
||||
@@ -367,5 +367,5 @@ def test_public_errors():
|
||||
|
||||
# Test format
|
||||
if klass.format is not None:
|
||||
assert klass.format is errors2.__messages[i]
|
||||
assert klass.format is errors.__messages[i]
|
||||
i += 1
|
||||
@@ -26,7 +26,7 @@ from tests.util import check_TypeError, ClassChecker, create_test_api
|
||||
from tests.util import assert_equal
|
||||
from ipalib.constants import TYPE_ERROR
|
||||
from ipalib.base import NameSpace
|
||||
from ipalib import frontend, backend, plugable, errors2, parameters, config
|
||||
from ipalib import frontend, backend, plugable, errors, parameters, config
|
||||
|
||||
def test_RULE_FLAG():
|
||||
assert frontend.RULE_FLAG == 'validation_rule'
|
||||
@@ -274,7 +274,7 @@ class test_Command(ClassChecker):
|
||||
# Check with an invalid value
|
||||
fail = dict(okay)
|
||||
fail['option0'] = u'whatever'
|
||||
e = raises(errors2.ValidationError, sub.validate, **fail)
|
||||
e = raises(errors.ValidationError, sub.validate, **fail)
|
||||
assert_equal(e.name, 'option0')
|
||||
assert_equal(e.value, u'whatever')
|
||||
assert_equal(e.error, u"must equal 'option0'")
|
||||
@@ -284,7 +284,7 @@ class test_Command(ClassChecker):
|
||||
# Check with a missing required arg
|
||||
fail = dict(okay)
|
||||
fail.pop('option1')
|
||||
e = raises(errors2.RequirementError, sub.validate, **fail)
|
||||
e = raises(errors.RequirementError, sub.validate, **fail)
|
||||
assert e.name == 'option1'
|
||||
|
||||
def test_execute(self):
|
||||
@@ -304,26 +304,26 @@ class test_Command(ClassChecker):
|
||||
|
||||
# Test that ZeroArgumentError is raised:
|
||||
o = self.get_instance()
|
||||
e = raises(errors2.ZeroArgumentError, o.args_options_2_params, 1)
|
||||
e = raises(errors.ZeroArgumentError, o.args_options_2_params, 1)
|
||||
assert e.name == 'example'
|
||||
|
||||
# Test that MaxArgumentError is raised (count=1)
|
||||
o = self.get_instance(args=('one?',))
|
||||
e = raises(errors2.MaxArgumentError, o.args_options_2_params, 1, 2)
|
||||
e = raises(errors.MaxArgumentError, o.args_options_2_params, 1, 2)
|
||||
assert e.name == 'example'
|
||||
assert e.count == 1
|
||||
assert str(e) == "command 'example' takes at most 1 argument"
|
||||
|
||||
# Test that MaxArgumentError is raised (count=2)
|
||||
o = self.get_instance(args=('one', 'two?'))
|
||||
e = raises(errors2.MaxArgumentError, o.args_options_2_params, 1, 2, 3)
|
||||
e = raises(errors.MaxArgumentError, o.args_options_2_params, 1, 2, 3)
|
||||
assert e.name == 'example'
|
||||
assert e.count == 2
|
||||
assert str(e) == "command 'example' takes at most 2 arguments"
|
||||
|
||||
# Test that OverlapError is raised:
|
||||
o = self.get_instance(args=('one', 'two'), options=('three', 'four'))
|
||||
e = raises(errors2.OverlapError, o.args_options_2_params,
|
||||
e = raises(errors.OverlapError, o.args_options_2_params,
|
||||
1, 2, three=3, two=2, four=4, one=1)
|
||||
assert e.names == ['one', 'two']
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from inspect import isclass
|
||||
from tests.util import raises, ClassChecker, read_only
|
||||
from tests.util import dummy_ugettext, assert_equal
|
||||
from tests.data import binary_bytes, utf8_bytes, unicode_str
|
||||
from ipalib import parameters, request, errors2
|
||||
from ipalib import parameters, request, errors
|
||||
from ipalib.constants import TYPE_ERROR, CALLABLE_ERROR, NULLS
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ class test_Param(ClassChecker):
|
||||
assert o._convert_scalar(None) is None
|
||||
assert dummy.called() is False
|
||||
# Test with incorrect type
|
||||
e = raises(errors2.ConversionError, o._convert_scalar, 'hello', index=17)
|
||||
e = raises(errors.ConversionError, o._convert_scalar, 'hello', index=17)
|
||||
|
||||
def test_validate(self):
|
||||
"""
|
||||
@@ -388,7 +388,7 @@ class test_Param(ClassChecker):
|
||||
|
||||
# Test in default state (with no rules, no kwarg):
|
||||
o = self.cls('my_param')
|
||||
e = raises(errors2.RequirementError, o.validate, None)
|
||||
e = raises(errors.RequirementError, o.validate, None)
|
||||
assert e.name == 'my_param'
|
||||
|
||||
# Test with required=False
|
||||
@@ -399,7 +399,7 @@ class test_Param(ClassChecker):
|
||||
# Test with query=True:
|
||||
o = self.cls('my_param', query=True)
|
||||
assert o.query is True
|
||||
e = raises(errors2.RequirementError, o.validate, None)
|
||||
e = raises(errors.RequirementError, o.validate, None)
|
||||
assert_equal(e.name, 'my_param')
|
||||
|
||||
# Test with multivalue=True:
|
||||
@@ -431,7 +431,7 @@ class test_Param(ClassChecker):
|
||||
pass1.reset()
|
||||
pass2.reset()
|
||||
o = Example('example', pass1, pass2, fail)
|
||||
e = raises(errors2.ValidationError, o.validate, 42)
|
||||
e = raises(errors.ValidationError, o.validate, 42)
|
||||
assert e.name == 'example'
|
||||
assert e.error == u'no good'
|
||||
assert e.index is None
|
||||
@@ -458,7 +458,7 @@ class test_Param(ClassChecker):
|
||||
pass2.reset()
|
||||
o = Example('multi_example', pass1, pass2, fail, multivalue=True)
|
||||
assert o.multivalue is True
|
||||
e = raises(errors2.ValidationError, o.validate, (3, 9))
|
||||
e = raises(errors.ValidationError, o.validate, (3, 9))
|
||||
assert e.name == 'multi_example'
|
||||
assert e.error == u'this one is not good'
|
||||
assert e.index == 0
|
||||
@@ -495,11 +495,11 @@ class test_Param(ClassChecker):
|
||||
okay = DummyRule()
|
||||
fail = DummyRule(u'this describes the error')
|
||||
o = MyParam('my_param', okay, fail)
|
||||
e = raises(errors2.ValidationError, o._validate_scalar, True)
|
||||
e = raises(errors.ValidationError, o._validate_scalar, True)
|
||||
assert e.name == 'my_param'
|
||||
assert e.error == u'this describes the error'
|
||||
assert e.index is None
|
||||
e = raises(errors2.ValidationError, o._validate_scalar, False, index=2)
|
||||
e = raises(errors.ValidationError, o._validate_scalar, False, index=2)
|
||||
assert e.name == 'my_param'
|
||||
assert e.error == u'this describes the error'
|
||||
assert e.index == 2
|
||||
@@ -868,11 +868,11 @@ class test_Str(ClassChecker):
|
||||
assert mthd(value) == unicode(value)
|
||||
bad = [True, 'Hello', (u'Hello',), [42.3], dict(one=1), utf8_bytes]
|
||||
for value in bad:
|
||||
e = raises(errors2.ConversionError, mthd, value)
|
||||
e = raises(errors.ConversionError, mthd, value)
|
||||
assert e.name == 'my_str'
|
||||
assert e.index is None
|
||||
assert_equal(e.error, u'must be Unicode text')
|
||||
e = raises(errors2.ConversionError, mthd, value, index=18)
|
||||
e = raises(errors.ConversionError, mthd, value, index=18)
|
||||
assert e.name == 'my_str'
|
||||
assert e.index == 18
|
||||
assert_equal(e.error, u'must be Unicode text')
|
||||
|
||||
@@ -25,7 +25,7 @@ import inspect
|
||||
from tests.util import raises, no_set, no_del, read_only
|
||||
from tests.util import getitem, setitem, delitem
|
||||
from tests.util import ClassChecker, create_test_api
|
||||
from ipalib import plugable, errors2
|
||||
from ipalib import plugable, errors
|
||||
|
||||
|
||||
class test_SetProxy(ClassChecker):
|
||||
@@ -372,7 +372,7 @@ class test_Plugin(ClassChecker):
|
||||
"""
|
||||
o = self.cls()
|
||||
o.call('/bin/true') is None
|
||||
e = raises(errors2.SubprocessError, o.call, '/bin/false')
|
||||
e = raises(errors.SubprocessError, o.call, '/bin/false')
|
||||
assert e.returncode == 1
|
||||
assert e.argv == ('/bin/false',)
|
||||
|
||||
@@ -539,7 +539,7 @@ def test_Registrar():
|
||||
|
||||
# Check that SubclassError is raised trying to register a class that is
|
||||
# not a subclass of an allowed base:
|
||||
e = raises(errors2.PluginSubclassError, r, plugin3)
|
||||
e = raises(errors.PluginSubclassError, r, plugin3)
|
||||
assert e.plugin is plugin3
|
||||
|
||||
# Check that registration works
|
||||
@@ -550,7 +550,7 @@ def test_Registrar():
|
||||
|
||||
# Check that DuplicateError is raised trying to register exact class
|
||||
# again:
|
||||
e = raises(errors2.PluginDuplicateError, r, plugin1)
|
||||
e = raises(errors.PluginDuplicateError, r, plugin1)
|
||||
assert e.plugin is plugin1
|
||||
|
||||
# Check that OverrideError is raised trying to register class with same
|
||||
@@ -560,7 +560,7 @@ def test_Registrar():
|
||||
pass
|
||||
class plugin1(base1_extended):
|
||||
pass
|
||||
e = raises(errors2.PluginOverrideError, r, plugin1)
|
||||
e = raises(errors.PluginOverrideError, r, plugin1)
|
||||
assert e.base == 'Base1'
|
||||
assert e.name == 'plugin1'
|
||||
assert e.plugin is plugin1
|
||||
@@ -573,7 +573,7 @@ def test_Registrar():
|
||||
|
||||
# Check that MissingOverrideError is raised trying to override a name
|
||||
# not yet registerd:
|
||||
e = raises(errors2.PluginMissingOverrideError, r, plugin2, override=True)
|
||||
e = raises(errors.PluginMissingOverrideError, r, plugin2, override=True)
|
||||
assert e.base == 'Base2'
|
||||
assert e.name == 'plugin2'
|
||||
assert e.plugin is plugin2
|
||||
|
||||
@@ -27,7 +27,7 @@ from tests.util import raises, assert_equal, PluginTester, DummyClass
|
||||
from tests.data import binary_bytes, utf8_bytes, unicode_str
|
||||
from ipalib.frontend import Command
|
||||
from ipalib.request import context, Connection
|
||||
from ipalib import rpc, errors2
|
||||
from ipalib import rpc, errors
|
||||
|
||||
|
||||
std_compound = (binary_bytes, utf8_bytes, unicode_str)
|
||||
@@ -233,11 +233,11 @@ class test_xmlclient(PluginTester):
|
||||
assert o.forward('user_add', *args, **kw) == result
|
||||
|
||||
# Test with an errno the client knows:
|
||||
e = raises(errors2.RequirementError, o.forward, 'user_add', *args, **kw)
|
||||
e = raises(errors.RequirementError, o.forward, 'user_add', *args, **kw)
|
||||
assert_equal(e.message, u"'four' is required")
|
||||
|
||||
# Test with an errno the client doesn't know
|
||||
e = raises(errors2.UnknownError, o.forward, 'user_add', *args, **kw)
|
||||
e = raises(errors.UnknownError, o.forward, 'user_add', *args, **kw)
|
||||
assert_equal(e.code, 700)
|
||||
assert_equal(e.error, u'no such error')
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Test the `ipaserver.rpc` module.
|
||||
|
||||
from tests.util import create_test_api, raises, PluginTester
|
||||
from tests.data import unicode_str
|
||||
from ipalib import errors2, Command
|
||||
from ipalib import errors, Command
|
||||
from ipaserver import rpcserver
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_automount' module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Service(XMLRPC_test):
|
||||
@@ -70,7 +70,7 @@ class test_Service(XMLRPC_test):
|
||||
"""
|
||||
try:
|
||||
res = api.Command['automount_addkey'](**self.key_kw)
|
||||
except errors2.DuplicateEntry:
|
||||
except errors.DuplicateEntry:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -145,7 +145,7 @@ class test_Service(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showkey'](**delkey_kw)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -160,7 +160,7 @@ class test_Service(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showmap'](self.mapname)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -173,7 +173,7 @@ class test_Service(XMLRPC_test):
|
||||
key_kw={'automountmapname': self.mapname, 'automountkey': self.keyname2}
|
||||
try:
|
||||
res = api.Command['automount_showkey'](**key_kw)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -216,7 +216,7 @@ class test_Indirect(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showkey'](**delkey_kw)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -231,7 +231,7 @@ class test_Indirect(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showmap'](self.mapname)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -274,7 +274,7 @@ class test_IndirectNoParent(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showkey'](**delkey_kw)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -289,7 +289,7 @@ class test_IndirectNoParent(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['automount_showmap'](self.mapname)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_group` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Group(XMLRPC_test):
|
||||
@@ -52,7 +52,7 @@ class test_Group(XMLRPC_test):
|
||||
"""
|
||||
try:
|
||||
res = api.Command['group_add'](**self.kw)
|
||||
except errors2.DuplicateEntry:
|
||||
except errors.DuplicateEntry:
|
||||
pass
|
||||
|
||||
def test_add3(self):
|
||||
@@ -195,7 +195,7 @@ class test_Group(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -210,7 +210,7 @@ class test_Group(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.cn2)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -225,7 +225,7 @@ class test_Group(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.cnposix)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_host` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Host(XMLRPC_test):
|
||||
@@ -117,7 +117,7 @@ class test_Host(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['host_show'](self.cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_hostgroup` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Host(XMLRPC_test):
|
||||
@@ -123,7 +123,7 @@ class test_Host(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['hostgroup_show'](self.cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -138,7 +138,7 @@ class test_Host(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['host_show'](self.host_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_netgroup` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
def is_member_of(members, candidate):
|
||||
@@ -259,7 +259,7 @@ class test_Netgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['netgroup_show'](self.ng_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -275,7 +275,7 @@ class test_Netgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['host_show'](self.host_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -287,7 +287,7 @@ class test_Netgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['hostgroup_show'](self.hg_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -299,7 +299,7 @@ class test_Netgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['user_show'](self.user_uid)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -311,7 +311,7 @@ class test_Netgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.group_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/rolegroup` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Rolegroup(XMLRPC_test):
|
||||
@@ -122,7 +122,7 @@ class test_Rolegroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['rolegroup_show'](self.cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -137,7 +137,7 @@ class test_Rolegroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.rolegroup_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_service` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Service(XMLRPC_test):
|
||||
@@ -51,7 +51,7 @@ class test_Service(XMLRPC_test):
|
||||
kw={'principal':self.hostprincipal}
|
||||
try:
|
||||
res = api.Command['service_add'](**kw)
|
||||
except errors2.HostService:
|
||||
except errors.HostService:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -63,7 +63,7 @@ class test_Service(XMLRPC_test):
|
||||
kw={'principal': u'foo'}
|
||||
try:
|
||||
res = api.Command['service_add'](**kw)
|
||||
except errors2.MalformedServicePrincipal:
|
||||
except errors.MalformedServicePrincipal:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -75,7 +75,7 @@ class test_Service(XMLRPC_test):
|
||||
kw={'principal': u'HTTP/foo@FOO.NET'}
|
||||
try:
|
||||
res = api.Command['service_add'](**kw)
|
||||
except errors2.RealmMismatch:
|
||||
except errors.RealmMismatch:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -107,7 +107,7 @@ class test_Service(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['service_show'](self.principal)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/taskgroup` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_Taskgroup(XMLRPC_test):
|
||||
@@ -152,7 +152,7 @@ class test_Taskgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['taskgroup_show'](self.cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -167,7 +167,7 @@ class test_Taskgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['group_show'](self.taskgroup_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
@@ -182,7 +182,7 @@ class test_Taskgroup(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['rolegroup_show'](self.rolegroup_cn)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_user` module.
|
||||
import sys
|
||||
from xmlrpc_test import XMLRPC_test
|
||||
from ipalib import api
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_User(XMLRPC_test):
|
||||
@@ -55,7 +55,7 @@ class test_User(XMLRPC_test):
|
||||
"""
|
||||
try:
|
||||
res = api.Command['user_add'](**self.kw)
|
||||
except errors2.DuplicateEntry:
|
||||
except errors.DuplicateEntry:
|
||||
pass
|
||||
|
||||
def test_doshow(self):
|
||||
@@ -140,7 +140,7 @@ class test_User(XMLRPC_test):
|
||||
# Verify that it is gone
|
||||
try:
|
||||
res = api.Command['user_show'](self.uid)
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -25,7 +25,7 @@ import sys
|
||||
import socket
|
||||
import nose
|
||||
from ipalib import api, request
|
||||
from ipalib import errors2
|
||||
from ipalib import errors
|
||||
|
||||
# Initialize the API. We do this here so that one can run the tests
|
||||
# individually instead of at the top-level. If API.bootstrap()
|
||||
@@ -50,9 +50,9 @@ class XMLRPC_test(object):
|
||||
if not api.Backend.xmlclient.isconnected():
|
||||
api.Backend.xmlclient.connect()
|
||||
res = api.Command['user_show'](u'notfound')
|
||||
except errors2.NetworkError:
|
||||
except errors.NetworkError:
|
||||
raise nose.SkipTest()
|
||||
except errors2.NotFound:
|
||||
except errors.NotFound:
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
Reference in New Issue
Block a user