mirror of
https://github.com/kakwa/ldapcherry
synced 2025-07-03 03:47:35 +02:00
better checks for attributes
This commit is contained in:
parent
679c2bba85
commit
a71093038c
4 changed files with 41 additions and 20 deletions
20
tests/cfg/attributes_wrong_type.yml
Normal file
20
tests/cfg/attributes_wrong_type.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
cn:
|
||||
description: "Firt Name and Display Name"
|
||||
display_name: "Display Name"
|
||||
type: notatype
|
||||
autofill:
|
||||
function: cn
|
||||
args:
|
||||
- $first-name
|
||||
- $name
|
||||
backend-attributes:
|
||||
ldap: cn
|
||||
ad: CN
|
||||
|
||||
first-name:
|
||||
description: "First name of the user"
|
||||
display_name: "First Name"
|
||||
type: string
|
||||
backend-attributes:
|
||||
ldap: givenName
|
||||
ad: givenName
|
|
@ -8,7 +8,7 @@ import pytest
|
|||
import sys
|
||||
from sets import Set
|
||||
from ldapcherry.attributes import Attributes
|
||||
from ldapcherry.exceptions import MissingAttributesFile, MissingKey
|
||||
from ldapcherry.exceptions import MissingAttributesFile, MissingKey, WrongAttributeType
|
||||
from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError
|
||||
|
||||
class TestError(object):
|
||||
|
@ -33,27 +33,16 @@ class TestError(object):
|
|||
else:
|
||||
raise AssertionError("expected an exception")
|
||||
|
||||
# def testAttrKeyDuplication(self):
|
||||
# try:
|
||||
# inv = Attributes('./tests/cfg/attributes_key_dup.yml')
|
||||
# except DumplicateAttrKey:
|
||||
# return
|
||||
# else:
|
||||
# raise AssertionError("expected an exception")
|
||||
#
|
||||
def testWrongType(self):
|
||||
try:
|
||||
inv = Attributes('./tests/cfg/attributes_wrong_type.yml')
|
||||
except WrongAttributeType:
|
||||
return
|
||||
else:
|
||||
raise AssertionError("expected an exception")
|
||||
|
||||
# def testGetDisplayNameMissingAttr(self):
|
||||
# inv = Attributes('./tests/cfg/attributes.yml')
|
||||
# try:
|
||||
# res = inv.get_display_name('notarole')
|
||||
# except MissingAttr:
|
||||
# return
|
||||
# else:
|
||||
# raise AssertionError("expected an exception")
|
||||
#
|
||||
# def testGetDisplayName(self):
|
||||
# inv = Attributes('./tests/cfg/attributes.yml')
|
||||
# res = inv.get_display_name('users')
|
||||
# expected = 'Simple Users'
|
||||
# assert res == expected
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue