Imported Debian patch 4.7.2-3

This commit is contained in:
Timo Aaltonen
2019-05-06 08:43:34 +03:00
committed by Mario Fetka
parent 27edeba051
commit 8bc559c5a1
917 changed files with 1068993 additions and 1184676 deletions

View File

@@ -25,7 +25,6 @@ Test the `ipalib.plugable` module.
# pylint: disable=no-member
import os
import sys
import textwrap
from ipalib import plugable, errors, create_api
@@ -36,7 +35,6 @@ import pytest
pytestmark = pytest.mark.tier0
class test_Plugin(ClassChecker):
"""
Test the `ipalib.plugable.Plugin` class.
@@ -78,11 +76,19 @@ class test_Plugin(ClassChecker):
assert o.summary == u'<%s.%s>' % (another_subclass.__module__,
another_subclass.__name__)
# Test that Plugin makes sure the subclass hasn't defined attributes
# whose names conflict with the logger methods set in Plugin.__init__():
class check(self.cls):
info = 'whatever'
e = raises(Exception, check, api)
assert str(e) == \
"info is already bound to ipatests.test_ipalib.test_plugable.check()"
def test_finalize(self):
"""
Test the `ipalib.plugable.Plugin.finalize` method.
"""
class api:
class api(object):
@staticmethod
def is_production_mode():
return False
@@ -96,15 +102,14 @@ def test_Registry():
"""
Test the `ipalib.plugable.Registry` class
"""
class Base1:
class Base1(object):
pass
class Base2(object):
pass
class Base2:
pass
class plugin1(Base1):
pass
class plugin2(Base2):
pass
@@ -302,44 +307,3 @@ class test_API(ClassChecker):
os.environ['IPA_CONFDIR'] = ipa_confdir
else:
os.environ.pop('IPA_CONFDIR')
class test_cli(ClassChecker):
"""
Test the `ipalib.plugable` global bootstrap.
"""
def test_no_args(self):
sys.argv = ['/usr/bin/ipa']
api = create_api(mode='unit_test')
(_options, argv) = api.bootstrap_with_global_options(
context='unit_test')
assert len(argv) == 0
assert _options.env is None
assert _options.conf is None
assert _options.debug is None
assert _options.delegate is None
assert _options.verbose is None
def test_one_arg(self):
sys.argv = ['/usr/bin/ipa', 'user-show']
api = create_api(mode='unit_test')
(_options, argv) = api.bootstrap_with_global_options(
context='unit_test')
assert argv == ['user-show']
assert _options.verbose is None
def test_args_valid_option(self):
sys.argv = ['/usr/bin/ipa', '-v', 'user-show']
api = create_api(mode='unit_test')
(_options, argv) = api.bootstrap_with_global_options(
context='unit_test')
assert argv == ['user-show']
assert _options.verbose == 1
def test_args_invalid_option(self):
sys.argv = ['/usr/bin/ipa', '-verbose', 'user-show']
api = create_api(mode='unit_test')
try:
api.bootstrap_with_global_options(context='unit_test')
except errors.OptionError as e:
assert e.msg == 'Unable to parse option rbose'