예제 #1
0
def test_identity_attribute_1():
    (forward, backward) = utils.parse_attribute_map(
        [full_path("attribute.map")])
    a = Attribute(name="urn:oid:2.5.4.4", name_format=NAME_FORMAT_URI)

    assert utils.identity_attribute("name", a, forward) == "urn:oid:2.5.4.4"
    assert utils.identity_attribute("friendly", a, forward) == "surName"
예제 #2
0
def test_parse_attribute_map():
    (forward, backward) = utils.parse_attribute_map(
        [full_path("attribute.map")])

    assert _eq(forward.keys(), backward.values())
    assert _eq(forward.values(), backward.keys())
    print forward.keys()
    assert _oeq(forward.keys(), [
        ('urn:oid:1.3.6.1.4.1.5923.1.1.1.7', NAME_FORMAT_URI),
        ('urn:oid:0.9.2342.19200300.100.1.1', NAME_FORMAT_URI),
        ('urn:oid:1.3.6.1.4.1.5923.1.1.1.1', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.42', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.4', NAME_FORMAT_URI),
        ('urn:oid:0.9.2342.19200300.100.1.3', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.12', NAME_FORMAT_URI)])
    assert _eq(forward.keys(), [
        ('urn:oid:1.3.6.1.4.1.5923.1.1.1.7', NAME_FORMAT_URI),
        ('urn:oid:0.9.2342.19200300.100.1.1', NAME_FORMAT_URI),
        ('urn:oid:1.3.6.1.4.1.5923.1.1.1.1', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.42', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.4', NAME_FORMAT_URI),
        ('urn:oid:0.9.2342.19200300.100.1.3', NAME_FORMAT_URI),
        ('urn:oid:2.5.4.12', NAME_FORMAT_URI)])
    assert _eq(backward.keys(), ["surName", "givenName", "title", "uid", "mail",
                                 "eduPersonAffiliation",
                                 "eduPersonEntitlement"])
예제 #3
0
def test_parse_attribute_map():
    (forward, backward) = utils.parse_attribute_map(["attribute.map"])

    assert _eq(forward.keys(), backward.values())
    assert _eq(forward.values(), backward.keys())
    print forward.keys()
    assert _oeq(forward.keys(),
                [('urn:oid:1.3.6.1.4.1.5923.1.1.1.7', NAME_FORMAT_URI),
                 ('urn:oid:0.9.2342.19200300.100.1.1', NAME_FORMAT_URI),
                 ('urn:oid:1.3.6.1.4.1.5923.1.1.1.1', NAME_FORMAT_URI),
                 ('urn:oid:2.5.4.42', NAME_FORMAT_URI),
                 ('urn:oid:2.5.4.4', NAME_FORMAT_URI),
                 ('urn:oid:0.9.2342.19200300.100.1.3', NAME_FORMAT_URI),
                 ('urn:oid:2.5.4.12', NAME_FORMAT_URI)])
    assert _eq(forward.keys(),
               [('urn:oid:1.3.6.1.4.1.5923.1.1.1.7', NAME_FORMAT_URI),
                ('urn:oid:0.9.2342.19200300.100.1.1', NAME_FORMAT_URI),
                ('urn:oid:1.3.6.1.4.1.5923.1.1.1.1', NAME_FORMAT_URI),
                ('urn:oid:2.5.4.42', NAME_FORMAT_URI),
                ('urn:oid:2.5.4.4', NAME_FORMAT_URI),
                ('urn:oid:0.9.2342.19200300.100.1.3', NAME_FORMAT_URI),
                ('urn:oid:2.5.4.12', NAME_FORMAT_URI)])
    assert _eq(backward.keys(), [
        "surName", "givenName", "title", "uid", "mail", "eduPersonAffiliation",
        "eduPersonEntitlement"
    ])
예제 #4
0
def test_identity_attribute_1():
    (forward,
     backward) = utils.parse_attribute_map([full_path("attribute.map")])
    a = Attribute(name="urn:oid:2.5.4.4", name_format=NAME_FORMAT_URI)

    assert utils.identity_attribute("name", a, forward) == "urn:oid:2.5.4.4"
    assert utils.identity_attribute("friendly", a, forward) == "surName"
예제 #5
0
def test_identity_attribute_2():
    (forward, backward) = utils.parse_attribute_map([full_path("attribute.map")])
    a = Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI)
    
    assert utils.identity_attribute("name",a,forward) == "urn:oid:2.5.4.5"
    # if there would be a map it would be serialNumber
    assert utils.identity_attribute("friendly",a,forward) == "urn:oid:2.5.4.5"
예제 #6
0
def test_identity_attribute_2():
    (forward, backward) = utils.parse_attribute_map(["attribute.map"])
    a = Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI)

    assert utils.identity_attribute("name", a, forward) == "urn:oid:2.5.4.5"
    # if there would be a map it would be serialNumber
    assert utils.identity_attribute("friendly", a,
                                    forward) == "urn:oid:2.5.4.5"