From 7721443a625b2efd0744ad347c62795e5ba6bb91 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 7 Oct 2008 20:41:15 -0600 Subject: Moved ipalib/tests/ into tests/test_ipalib/ --- tests/test_ipalib/test_crud.py | 168 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 tests/test_ipalib/test_crud.py (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py new file mode 100644 index 00000000..9355f237 --- /dev/null +++ b/tests/test_ipalib/test_crud.py @@ -0,0 +1,168 @@ +# Authors: +# Jason Gerard DeRose +# +# Copyright (C) 2008 Red Hat +# see file 'COPYING' for use and warranty information +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 only +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" +Unit tests for `ipalib.crud` module. +""" + +from tstutil import read_only, raises, ClassChecker +from ipalib import crud, frontend, plugable, config + +def get_api(): + api = plugable.API( + frontend.Object, + frontend.Method, + frontend.Property, + ) + api.env.update(config.generate_env()) + class user(frontend.Object): + takes_params = ( + 'givenname', + 'sn', + frontend.Param('uid', primary_key=True), + 'initials', + ) + api.register(user) + return api + + +class test_Add(ClassChecker): + """ + Test the `crud.Add` class. + """ + + _cls = crud.Add + + def test_class(self): + assert self.cls.__bases__ == (frontend.Method,) + + def test_options_args(self): + """ + Test `crud.Add.get_args` and `crud.Add.get_options` methods. + """ + api = get_api() + class user_add(self.cls): + pass + api.register(user_add) + api.finalize() + assert list(api.Method.user_add.args) == ['uid'] + assert list(api.Method.user_add.options) == \ + ['givenname', 'sn', 'initials'] + for param in api.Method.user_add.options(): + assert param.required is True + + +class test_Get(ClassChecker): + """ + Test the `crud.Get` class. + """ + + _cls = crud.Get + + def test_class(self): + assert self.cls.__bases__ == (frontend.Method,) + + def test_options_args(self): + """ + Test `crud.Get.get_args` and `crud.Get.get_options` methods. + """ + api = get_api() + class user_get(self.cls): + pass + api.register(user_get) + api.finalize() + assert list(api.Method.user_get.args) == ['uid'] + assert list(api.Method.user_get.options) == [] + + +class test_Del(ClassChecker): + """ + Test the `crud.Del` class. + """ + + _cls = crud.Del + + def test_class(self): + assert self.cls.__bases__ == (frontend.Method,) + + def test_options_args(self): + """ + Test `crud.Del.get_args` and `crud.Del.get_options` methods. + """ + api = get_api() + class user_del(self.cls): + pass + api.register(user_del) + api.finalize() + assert list(api.Method.user_del.args) == ['uid'] + assert list(api.Method.user_del.options) == [] + + +class test_Mod(ClassChecker): + """ + Test the `crud.Mod` class. + """ + + _cls = crud.Mod + + def test_class(self): + assert self.cls.__bases__ == (frontend.Method,) + + def test_options_args(self): + """ + Test `crud.Mod.get_args` and `crud.Mod.get_options` methods. + """ + api = get_api() + class user_mod(self.cls): + pass + api.register(user_mod) + api.finalize() + assert list(api.Method.user_mod.args) == ['uid'] + assert api.Method.user_mod.args[0].required is True + assert list(api.Method.user_mod.options) == \ + ['givenname', 'sn', 'initials'] + for param in api.Method.user_mod.options(): + assert param.required is False + + +class test_Find(ClassChecker): + """ + Test the `crud.Find` class. + """ + + _cls = crud.Find + + def test_class(self): + assert self.cls.__bases__ == (frontend.Method,) + + def test_options_args(self): + """ + Test `crud.Find.get_args` and `crud.Find.get_options` methods. + """ + api = get_api() + class user_find(self.cls): + pass + api.register(user_find) + api.finalize() + assert list(api.Method.user_find.args) == ['uid'] + assert api.Method.user_find.args[0].required is True + assert list(api.Method.user_find.options) == \ + ['givenname', 'sn', 'initials'] + for param in api.Method.user_find.options(): + assert param.required is False -- cgit From af56c71d506c2573f99a1ca8334cfa90dc7f74d7 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 7 Oct 2008 21:25:23 -0600 Subject: Cleaned up package and module level docstrings for everything in tests/ --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 9355f237..fbfbfab1 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -Unit tests for `ipalib.crud` module. +Test the `ipalib.crud` module. """ from tstutil import read_only, raises, ClassChecker -- cgit From f6ac2df6bd7ceddd0f3eb968198cc3ebd1388087 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 7 Oct 2008 21:59:47 -0600 Subject: Moved tstutil.py into base of tests so it can be used by all test subpackages more easily --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index fbfbfab1..e2dd60aa 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -21,7 +21,7 @@ Test the `ipalib.crud` module. """ -from tstutil import read_only, raises, ClassChecker +from tests.tstutil import read_only, raises, ClassChecker from ipalib import crud, frontend, plugable, config def get_api(): -- cgit From deb8e3dfc899cfc7ee31f47c1ba7c4301c58fc51 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 7 Oct 2008 22:30:53 -0600 Subject: Renamed tests/tstutil.py to tests/util.py --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index e2dd60aa..3113ec69 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -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(): -- cgit From f5ea3b1bb9430978cee6799d68f71da79bb4fd3a Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 7 Oct 2008 23:36:58 -0600 Subject: Made docstrings in test_crud.py contistent with rest --- tests/test_ipalib/test_crud.py | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 3113ec69..eb8be643 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -24,6 +24,7 @@ Test the `ipalib.crud` module. from tests.util import read_only, raises, ClassChecker from ipalib import crud, frontend, plugable, config + def get_api(): api = plugable.API( frontend.Object, @@ -44,17 +45,20 @@ def get_api(): class test_Add(ClassChecker): """ - Test the `crud.Add` class. + Test the `ipalib.crud.Add` class. """ _cls = crud.Add def test_class(self): + """ + Test the `ipalib.crud.Add` class. + """ assert self.cls.__bases__ == (frontend.Method,) def test_options_args(self): """ - Test `crud.Add.get_args` and `crud.Add.get_options` methods. + Test `ipalib.crud.Add.get_args` and `ipalib.crud.Add.get_options` methods. """ api = get_api() class user_add(self.cls): @@ -70,17 +74,20 @@ class test_Add(ClassChecker): class test_Get(ClassChecker): """ - Test the `crud.Get` class. + Test the `ipalib.crud.Get` class. """ _cls = crud.Get def test_class(self): + """ + Test the `ipalib.crud.Get` class. + """ assert self.cls.__bases__ == (frontend.Method,) def test_options_args(self): """ - Test `crud.Get.get_args` and `crud.Get.get_options` methods. + Test `ipalib.crud.Get.get_args` and `ipalib.crud.Get.get_options` methods. """ api = get_api() class user_get(self.cls): @@ -93,17 +100,20 @@ class test_Get(ClassChecker): class test_Del(ClassChecker): """ - Test the `crud.Del` class. + Test the `ipalib.crud.Del` class. """ _cls = crud.Del def test_class(self): + """ + Test the `ipalib.crud.Del` class. + """ assert self.cls.__bases__ == (frontend.Method,) def test_options_args(self): """ - Test `crud.Del.get_args` and `crud.Del.get_options` methods. + Test `ipalib.crud.Del.get_args` and `ipalib.crud.Del.get_options` methods. """ api = get_api() class user_del(self.cls): @@ -116,17 +126,20 @@ class test_Del(ClassChecker): class test_Mod(ClassChecker): """ - Test the `crud.Mod` class. + Test the `ipalib.crud.Mod` class. """ _cls = crud.Mod def test_class(self): + """ + Test the `ipalib.crud.Mod` class. + """ assert self.cls.__bases__ == (frontend.Method,) def test_options_args(self): """ - Test `crud.Mod.get_args` and `crud.Mod.get_options` methods. + Test `ipalib.crud.Mod.get_args` and `ipalib.crud.Mod.get_options` methods. """ api = get_api() class user_mod(self.cls): @@ -143,17 +156,20 @@ class test_Mod(ClassChecker): class test_Find(ClassChecker): """ - Test the `crud.Find` class. + Test the `ipalib.crud.Find` class. """ _cls = crud.Find def test_class(self): + """ + Test the `ipalib.crud.Find` class. + """ assert self.cls.__bases__ == (frontend.Method,) def test_options_args(self): """ - Test `crud.Find.get_args` and `crud.Find.get_options` methods. + Test `ipalib.crud.Find.get_args` and `ipalib.crud.Find.get_options` methods. """ api = get_api() class user_find(self.cls): -- cgit From 7599beb693b2ab0717299d5d07b17b045b2f7fe3 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 8 Oct 2008 00:17:32 -0600 Subject: Restructured test_crud.py around new CrudChecker base class --- tests/test_ipalib/test_crud.py | 168 ++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 85 deletions(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index eb8be643..1e538cc1 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -25,160 +25,158 @@ from tests.util import read_only, raises, ClassChecker from ipalib import crud, frontend, plugable, config -def get_api(): - api = plugable.API( - frontend.Object, - frontend.Method, - frontend.Property, - ) - api.env.update(config.generate_env()) - class user(frontend.Object): - takes_params = ( - 'givenname', - 'sn', - frontend.Param('uid', primary_key=True), - 'initials', +class CrudChecker(ClassChecker): + """ + Class for testing base classes in `ipalib.crud`. + """ + + def get_api(self): + """ + Return a finalized `ipalib.plugable.API` instance. + """ + assert self.cls.__bases__ == (frontend.Method,) + api = plugable.API( + frontend.Object, + frontend.Method, + frontend.Property, ) - api.register(user) - return api + api.env.update(config.generate_env()) + class user(frontend.Object): + takes_params = ( + 'givenname', + 'sn', + frontend.Param('uid', primary_key=True), + 'initials', + ) + class user_verb(self.cls): + pass + api.register(user) + api.register(user_verb) + api.finalize() + return api -class test_Add(ClassChecker): +class test_Add(CrudChecker): """ Test the `ipalib.crud.Add` class. """ _cls = crud.Add - def test_class(self): + def test_get_args(self): """ - Test the `ipalib.crud.Add` class. + Test the `ipalib.crud.Add.get_args` method. """ - assert self.cls.__bases__ == (frontend.Method,) + api = self.get_api() + assert list(api.Method.user_verb.args) == ['uid'] + assert api.Method.user_verb.args.uid.required is True - def test_options_args(self): + def test_get_options(self): """ - Test `ipalib.crud.Add.get_args` and `ipalib.crud.Add.get_options` methods. + Test the `ipalib.crud.Add.get_options` method. """ - api = get_api() - class user_add(self.cls): - pass - api.register(user_add) - api.finalize() - assert list(api.Method.user_add.args) == ['uid'] - assert list(api.Method.user_add.options) == \ + api = self.get_api() + assert list(api.Method.user_verb.options) == \ ['givenname', 'sn', 'initials'] - for param in api.Method.user_add.options(): + for param in api.Method.user_verb.options(): assert param.required is True -class test_Get(ClassChecker): +class test_Get(CrudChecker): """ Test the `ipalib.crud.Get` class. """ _cls = crud.Get - def test_class(self): + def test_get_args(self): """ - Test the `ipalib.crud.Get` class. + Test the `ipalib.crud.Get.get_args` method. """ - assert self.cls.__bases__ == (frontend.Method,) + api = self.get_api() + assert list(api.Method.user_verb.args) == ['uid'] + assert api.Method.user_verb.args.uid.required is True - def test_options_args(self): + def test_get_options(self): """ - Test `ipalib.crud.Get.get_args` and `ipalib.crud.Get.get_options` methods. + Test the `ipalib.crud.Get.get_options` method. """ - api = get_api() - class user_get(self.cls): - pass - api.register(user_get) - api.finalize() - assert list(api.Method.user_get.args) == ['uid'] - assert list(api.Method.user_get.options) == [] + api = self.get_api() + assert list(api.Method.user_verb.options) == [] + assert len(api.Method.user_verb.options) == 0 -class test_Del(ClassChecker): +class test_Del(CrudChecker): """ Test the `ipalib.crud.Del` class. """ _cls = crud.Del - def test_class(self): + def test_get_args(self): """ - Test the `ipalib.crud.Del` class. + Test the `ipalib.crud.Del.get_args` method. """ - assert self.cls.__bases__ == (frontend.Method,) + api = self.get_api() + assert list(api.Method.user_verb.args) == ['uid'] + assert api.Method.user_verb.args.uid.required is True - def test_options_args(self): + def test_get_options(self): """ - Test `ipalib.crud.Del.get_args` and `ipalib.crud.Del.get_options` methods. + Test the `ipalib.crud.Del.get_options` method. """ - api = get_api() - class user_del(self.cls): - pass - api.register(user_del) - api.finalize() - assert list(api.Method.user_del.args) == ['uid'] - assert list(api.Method.user_del.options) == [] + api = self.get_api() + assert list(api.Method.user_verb.options) == [] + assert len(api.Method.user_verb.options) == 0 -class test_Mod(ClassChecker): +class test_Mod(CrudChecker): """ Test the `ipalib.crud.Mod` class. """ _cls = crud.Mod - def test_class(self): + def test_get_args(self): """ - Test the `ipalib.crud.Mod` class. + Test the `ipalib.crud.Mod.get_args` method. """ - assert self.cls.__bases__ == (frontend.Method,) + api = self.get_api() + assert list(api.Method.user_verb.args) == ['uid'] + assert api.Method.user_verb.args.uid.required is True - def test_options_args(self): + def test_get_options(self): """ - Test `ipalib.crud.Mod.get_args` and `ipalib.crud.Mod.get_options` methods. + Test the `ipalib.crud.Mod.get_options` method. """ - api = get_api() - class user_mod(self.cls): - pass - api.register(user_mod) - api.finalize() - assert list(api.Method.user_mod.args) == ['uid'] - assert api.Method.user_mod.args[0].required is True - assert list(api.Method.user_mod.options) == \ + api = self.get_api() + assert list(api.Method.user_verb.options) == \ ['givenname', 'sn', 'initials'] - for param in api.Method.user_mod.options(): + for param in api.Method.user_verb.options(): assert param.required is False -class test_Find(ClassChecker): +class test_Find(CrudChecker): """ Test the `ipalib.crud.Find` class. """ _cls = crud.Find - def test_class(self): + def test_get_args(self): """ - Test the `ipalib.crud.Find` class. + Test the `ipalib.crud.Find.get_args` method. """ - assert self.cls.__bases__ == (frontend.Method,) + api = self.get_api() + assert list(api.Method.user_verb.args) == ['uid'] + assert api.Method.user_verb.args.uid.required is True - def test_options_args(self): + def test_get_options(self): """ - Test `ipalib.crud.Find.get_args` and `ipalib.crud.Find.get_options` methods. + Test the `ipalib.crud.Find.get_options` method. """ - api = get_api() - class user_find(self.cls): - pass - api.register(user_find) - api.finalize() - assert list(api.Method.user_find.args) == ['uid'] - assert api.Method.user_find.args[0].required is True - assert list(api.Method.user_find.options) == \ + api = self.get_api() + assert list(api.Method.user_verb.options) == \ ['givenname', 'sn', 'initials'] - for param in api.Method.user_find.options(): + for param in api.Method.user_verb.options(): assert param.required is False -- cgit From 87390665f6998116ec2429773088c7165e281611 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 9 Oct 2008 11:33:35 -0600 Subject: crud.Add.get_args() and get_options() now yield static values in takes_args, takes_options after the automagic ones --- tests/test_ipalib/test_crud.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 1e538cc1..37da503b 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -30,7 +30,7 @@ class CrudChecker(ClassChecker): Class for testing base classes in `ipalib.crud`. """ - def get_api(self): + def get_api(self, args=tuple(), options={}): """ Return a finalized `ipalib.plugable.API` instance. """ @@ -49,7 +49,8 @@ class CrudChecker(ClassChecker): 'initials', ) class user_verb(self.cls): - pass + takes_args = args + takes_options = options api.register(user) api.register(user_verb) api.finalize() @@ -70,6 +71,10 @@ class test_Add(CrudChecker): api = self.get_api() assert list(api.Method.user_verb.args) == ['uid'] assert api.Method.user_verb.args.uid.required is True + api = self.get_api(args=('extra?',)) + assert list(api.Method.user_verb.args) == ['uid', 'extra'] + assert api.Method.user_verb.args.uid.required is True + assert api.Method.user_verb.args.extra.required is False def test_get_options(self): """ @@ -80,6 +85,10 @@ class test_Add(CrudChecker): ['givenname', 'sn', 'initials'] for param in api.Method.user_verb.options(): assert param.required is True + api = self.get_api(options=('extra?',)) + assert list(api.Method.user_verb.options) == \ + ['givenname', 'sn', 'initials', 'extra'] + assert api.Method.user_verb.options.extra.required is False class test_Get(CrudChecker): -- cgit From 225e2b0c939d81b490c955762e125e8afcd5bb94 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 13 Oct 2008 09:50:29 -0600 Subject: Added CrudBackend abstract class defining generic CRUD API --- tests/test_ipalib/test_crud.py | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 37da503b..d7e6b51f 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -189,3 +189,54 @@ class test_Find(CrudChecker): ['givenname', 'sn', 'initials'] for param in api.Method.user_verb.options(): assert param.required is False + + +class test_CrudBackend(ClassChecker): + """ + Test the `ipalib.crud.CrudBackend` class. + """ + + _cls = crud.CrudBackend + + def get_subcls(self): + class ldap(self.cls): + pass + return ldap + + def check_method(self, name, *args): + o = self.cls() + e = raises(NotImplementedError, getattr(o, name), *args) + assert str(e) == 'CrudBackend.%s()' % name + sub = self.subcls() + e = raises(NotImplementedError, getattr(sub, name), *args) + assert str(e) == 'ldap.%s()' % name + + def test_create(self): + """ + Test the `ipalib.crud.CrudBackend.create` method. + """ + self.check_method('create') + + def test_retrieve(self): + """ + Test the `ipalib.crud.CrudBackend.retrieve` method. + """ + self.check_method('retrieve', 'primary key') + + def test_update(self): + """ + Test the `ipalib.crud.CrudBackend.update` method. + """ + self.check_method('update', 'primary key') + + def test_delete(self): + """ + Test the `ipalib.crud.CrudBackend.delete` method. + """ + self.check_method('delete', 'primary key') + + def test_search(self): + """ + Test the `ipalib.crud.CrudBackend.search` method. + """ + self.check_method('search') -- cgit From 3a80297b04d6fbfd2367ec76c5651d20293adccc Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 17 Oct 2008 22:55:03 +0200 Subject: Reworking Environment, moved it to config.py --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index d7e6b51f..9a207cce 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -40,7 +40,7 @@ class CrudChecker(ClassChecker): frontend.Method, frontend.Property, ) - api.env.update(config.generate_env()) + config.set_default_env(api.env) class user(frontend.Object): takes_params = ( 'givenname', -- cgit From 1be301821e7596d2db7e5b8e81d75ae1c6dab7f1 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 17 Oct 2008 16:47:09 -0600 Subject: Fixed unit test for CrudBacked.retrieve() --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 9a207cce..794921aa 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -221,7 +221,7 @@ class test_CrudBackend(ClassChecker): """ Test the `ipalib.crud.CrudBackend.retrieve` method. """ - self.check_method('retrieve', 'primary key') + self.check_method('retrieve', 'primary key', 'attribute') def test_update(self): """ -- cgit From d76202fea37e63fbc660ed2cf2059f455b8e2213 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 27 Oct 2008 01:35:40 -0600 Subject: API.env is now an Env instance rather than an Environment instance --- tests/test_ipalib/test_crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 794921aa..421eaca8 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -40,7 +40,7 @@ class CrudChecker(ClassChecker): frontend.Method, frontend.Property, ) - config.set_default_env(api.env) + #config.set_default_env(api.env) class user(frontend.Object): takes_params = ( 'givenname', -- cgit From a360b6479c515c723e6b6ad6909f78f40d24a069 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 30 Oct 2008 17:47:56 -0600 Subject: Fixed test_Del.test_get_options() --- tests/test_ipalib/test_crud.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 421eaca8..259bc60d 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -21,7 +21,7 @@ Test the `ipalib.crud` module. """ -from tests.util import read_only, raises, ClassChecker +from tests.util import read_only, raises, get_api, ClassChecker from ipalib import crud, frontend, plugable, config @@ -35,12 +35,7 @@ class CrudChecker(ClassChecker): Return a finalized `ipalib.plugable.API` instance. """ assert self.cls.__bases__ == (frontend.Method,) - api = plugable.API( - frontend.Object, - frontend.Method, - frontend.Property, - ) - #config.set_default_env(api.env) + (api, home) = get_api() class user(frontend.Object): takes_params = ( 'givenname', @@ -135,8 +130,9 @@ class test_Del(CrudChecker): Test the `ipalib.crud.Del.get_options` method. """ api = self.get_api() - assert list(api.Method.user_verb.options) == [] - assert len(api.Method.user_verb.options) == 0 + assert list(api.Method.user_verb.options) == \ + ['givenname', 'sn', 'initials'] + assert len(api.Method.user_verb.options) == 3 class test_Mod(CrudChecker): -- cgit From f18c84444d4ed87d79f3cb41156c6b66f49ccac3 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 31 Oct 2008 17:02:51 -0400 Subject: Partially revert back change. Del shouldn't provide default options. It can provide custom ones though, if defined with takes_params() in the class. --- tests/test_ipalib/test_crud.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/test_ipalib/test_crud.py') diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 259bc60d..ad391e2e 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -130,9 +130,8 @@ class test_Del(CrudChecker): Test the `ipalib.crud.Del.get_options` method. """ api = self.get_api() - assert list(api.Method.user_verb.options) == \ - ['givenname', 'sn', 'initials'] - assert len(api.Method.user_verb.options) == 3 + assert list(api.Method.user_verb.options) == [] + assert len(api.Method.user_verb.options) == 0 class test_Mod(CrudChecker): -- cgit