diff options
Diffstat (limited to 'ipalib/tests')
-rw-r--r-- | ipalib/tests/test_cli.py | 12 | ||||
-rw-r--r-- | ipalib/tests/test_public.py | 36 |
2 files changed, 26 insertions, 22 deletions
diff --git a/ipalib/tests/test_cli.py b/ipalib/tests/test_cli.py index a5ee8a94..2c65bd06 100644 --- a/ipalib/tests/test_cli.py +++ b/ipalib/tests/test_cli.py @@ -46,7 +46,7 @@ def test_from_cli(): def get_cmd_name(i): return 'cmd_%d' % i -class DummyCmd(object): +class DummyCommand(object): def __init__(self, name): self.__name = name @@ -60,11 +60,11 @@ class DummyAPI(object): def __get_cmd(self): return self.__cmd - cmd = property(__get_cmd) + Command = property(__get_cmd) def __cmd_iter(self, cnt): for i in xrange(cnt): - yield DummyCmd(get_cmd_name(i)) + yield DummyCommand(get_cmd_name(i)) def finalize(self): pass @@ -114,7 +114,7 @@ class test_CLI(ClassChecker): """ cnt = 100 api = DummyAPI(cnt) - len(api.cmd) == cnt + len(api.Command) == cnt o = self.cls(api) assert o.mcl is None o.finalize() @@ -126,10 +126,10 @@ class test_CLI(ClassChecker): """ cnt = 25 api = DummyAPI(cnt) - assert len(api.cmd) == cnt + assert len(api.Command) == cnt o = self.cls(api) o.finalize() - for cmd in api.cmd(): + for cmd in api.Command(): key = cli.to_cli(cmd.name) assert key in o assert o[key] is cmd diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py index 968e067f..d053081d 100644 --- a/ipalib/tests/test_public.py +++ b/ipalib/tests/test_public.py @@ -159,9 +159,9 @@ class test_option(ClassChecker): class test_cmd(ClassChecker): """ - Tests the `public.cmd` class. + Tests the `public.Command` class. """ - _cls = public.cmd + _cls = public.Command def get_subcls(self): class my_option(public.option): @@ -188,7 +188,7 @@ class test_cmd(ClassChecker): def test_get_options(self): """ - Tests the `public.cmd.get_options` method. + Tests the `public.Command.get_options` method. """ assert list(self.cls().get_options()) == [] sub = self.subcls() @@ -200,7 +200,7 @@ class test_cmd(ClassChecker): def test_options(self): """ - Tests the `public.cmd.options` property. + Tests the `public.Command.options` property. """ assert 'options' in self.cls.__public__ # Public sub = self.subcls() @@ -216,7 +216,7 @@ class test_cmd(ClassChecker): def test_normalize(self): """ - Tests the `public.cmd.normalize` method. + Tests the `public.Command.normalize` method. """ assert 'normalize' in self.cls.__public__ # Public kw = dict( @@ -230,7 +230,7 @@ class test_cmd(ClassChecker): def test_default(self): """ - Tests the `public.cmd.default` method. + Tests the `public.Command.default` method. """ assert 'default' in self.cls.__public__ # Public no_fill = dict( @@ -251,7 +251,7 @@ class test_cmd(ClassChecker): def test_validate(self): """ - Tests the `public.cmd.validate` method. + Tests the `public.Command.validate` method. """ assert 'validate' in self.cls.__public__ # Public @@ -281,7 +281,7 @@ class test_cmd(ClassChecker): def test_execute(self): """ - Tests the `public.cmd.execute` method. + Tests the `public.Command.execute` method. """ assert 'execute' in self.cls.__public__ # Public @@ -322,8 +322,8 @@ class test_mthd(ClassChecker): _cls = public.mthd def test_class(self): - assert self.cls.__bases__ == (public.attr, public.cmd) - assert self.cls.implements(public.cmd) + assert self.cls.__bases__ == (public.attr, public.Command) + assert self.cls.implements(public.Command) def get_subcls(self): class option0(public.option): @@ -338,10 +338,14 @@ class test_mthd(ClassChecker): __prop = None def __get_prop(self): if self.__prop is None: - self.__prop = ( - plugable.PluginProxy(public.prop, example_prop0(), 'attr_name'), - plugable.PluginProxy(public.prop, example_prop1(), 'attr_name'), - ) + self.__prop = plugable.NameSpace([ + plugable.PluginProxy( + public.prop, example_prop0(), 'attr_name' + ), + plugable.PluginProxy( + public.prop, example_prop1(), 'attr_name' + ), + ]) return self.__prop prop = property(__get_prop) class noun_verb(self.cls): @@ -377,11 +381,11 @@ def test_PublicAPI(): api = cls() - class cmd1(public.cmd): + class cmd1(public.Command): pass api.register(cmd1) - class cmd2(public.cmd): + class cmd2(public.Command): pass api.register(cmd2) |