How to use the bonsai.ldapvaluelist.LDAPValueList function in bonsai

To help you get started, we’ve selected a few bonsai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_insert():
    """ Test LDAPValueList's insert method. """
    lvl = LDAPValueList(("test1",))
    lvl.insert(0, "test2")
    assert lvl == ["test2", "test1"]
    with pytest.raises(ValueError):
        lvl.insert(2, "test2")
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_add():
    """ Test adding list to an LDAPValueList. """
    lvl = LDAPValueList((1, 2, 3))
    assert lvl + [4, 5] == [1, 2, 3, 4, 5]
    with pytest.raises(TypeError):
        _ = lvl + 3
    with pytest.raises(TypeError):
        lvl += "x"
    lvl += [4, 5]
    assert lvl == [1, 2, 3, 4, 5]
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_mul():
    """ Test multiplying an LDAPValueList. """
    lvl = LDAPValueList((1, 2, 3))
    with pytest.raises(TypeError):
        _ = lvl * 3
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_append():
    """ Test LDAPValueList's append method. """
    lvl = LDAPValueList()
    lvl.append("test")
    assert "test" in lvl
    with pytest.raises(ValueError):
        lvl.append("Test")
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_set_status():
    """ Test setting LDAPValueList's status. """
    lvl = LDAPValueList()
    with pytest.raises(TypeError):
        lvl.status = "a"
    with pytest.raises(ValueError):
        lvl.status = -1
    lvl.status = 2
    assert lvl.status == 2
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_extend():
    """ Test LDAPValueList's extend method. """
    lvl = LDAPValueList(("test1",))
    lvl.extend(("test2", "test3"))
    assert lvl == ["test1", "test2", "test3"]
    with pytest.raises(ValueError):
        lvl.extend(("test4", "test1"))
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_readonly_attrs():
    """ Test modifying read-only attributes. """
    lvl = LDAPValueList((1, 2, 3))
    with pytest.raises(ValueError):
        lvl.added = [1, 2, 3]
    with pytest.raises(ValueError):
        lvl.deleted = [1, 2, 3]
    with pytest.raises(TypeError):
        lvl._status_dict = {"status": 2}
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_copy():
    """ Test LDAPValueList's copy method. """
    lvl1 = LDAPValueList(("test1", "test2"))
    lvl2 = lvl1.copy()
    assert lvl1 == lvl2
    assert lvl1.status == lvl2.status
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_remove():
    """ Test LDAPValueList's remove method. """
    lvl = LDAPValueList(("test1", "test2"))
    lvl.remove("Test1")
    assert lvl == ["test2"]
    with pytest.raises(ValueError):
        lvl.remove("test1")
github noirello / bonsai / tests / test_ldapvaluelist.py View on Github external
def test_pop():
    """ Test LDAPValueList's pop method. """
    lvl = LDAPValueList(("test1", "test2"))
    assert lvl.pop(0) == "test1"
    assert lvl == ["test2"]
    lvl.pop()
    assert lvl == []
    with pytest.raises(IndexError):
        lvl.pop()