diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-07-19 23:40:23 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-07-19 23:40:23 +0000 |
commit | ccd8eb3373b0b195c1bc6efd8650320419c709a6 (patch) | |
tree | b5229b62c80a442ac5185dd254be37461cbd8b0d /ipalib/tests/test_crud.py | |
parent | e76160b01db52f9e750a605983eb85ae97305629 (diff) | |
download | freeipa-ccd8eb3373b0b195c1bc6efd8650320419c709a6.tar.gz freeipa-ccd8eb3373b0b195c1bc6efd8650320419c709a6.tar.xz freeipa-ccd8eb3373b0b195c1bc6efd8650320419c709a6.zip |
9: Reorganized new work and unit tests based around base.Object being the plugin definining unit
Diffstat (limited to 'ipalib/tests/test_crud.py')
-rw-r--r-- | ipalib/tests/test_crud.py | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/ipalib/tests/test_crud.py b/ipalib/tests/test_crud.py index 12ee1009..99113c4a 100644 --- a/ipalib/tests/test_crud.py +++ b/ipalib/tests/test_crud.py @@ -20,92 +20,3 @@ """ Unit tests for `ipalib.crud` module. """ - -from ipalib import crud, base, exceptions - -class create(crud.Command): - pass - -class retrieve(crud.Command): - pass - -class update(crud.Command): - pass - -class delete(crud.Command): - pass - -class givenName(crud.Attribute): - pass - -class sn(crud.Attribute): - pass - -class login(crud.Attribute): - pass - - -class user(crud.Object): - def get_commands(self): - return [ - create, - retrieve, - update, - delete, - ] - - def get_attributes(self): - return [ - givenName, - sn, - login, - ] - - -def test_Named(): - class named_class(crud.Named): - pass - - n = named_class() - assert n.name == 'named_class' - - -def test_Command(): - class user(object): - name = 'user' - class add(crud.Command): - pass - i = add(user()) - assert i.name == 'add' - assert i.full_name == 'add_user' - - -def test_Object(): - i = user() - assert i.name == 'user' - - # Test commands: - commands = i.commands - assert isinstance(commands, base.NameSpace) - assert list(commands) == ['create', 'delete', 'retrieve', 'update'] - assert len(commands) == 4 - for name in commands: - cls = globals()[name] - cmd = commands[name] - assert type(cmd) is cls - assert getattr(commands, name) is cmd - assert cmd.name == name - assert cmd.full_name == ('%s_user' % name) - - # Test attributes: - attributes = i.attributes - assert isinstance(attributes, base.NameSpace) - assert list(attributes) == ['givenName', 'sn', 'login'] - assert len(attributes) == 3 - for name in attributes: - cls = globals()[name] - attr = attributes[name] - assert type(attr) is cls - assert getattr(attributes, name) is attr - assert attr.name == name - assert attr.full_name == ('user_%s' % name) |