示例#1
0
def test_add(topo, fake_attr_value):
    """Check that we can add an attribute to a given suffix"""

    dse_ldif = DSEldif(topo.standalone)
    fake_attr = "fakeAttr"

    log.info("Add {} to {}".format(fake_attr, DN_CONFIG))
    dse_ldif.add(DN_CONFIG, fake_attr, fake_attr_value)
    attr_values = dse_ldif.get(DN_CONFIG, fake_attr)
    assert attr_values == [fake_attr_value]

    log.info("Clean up")
    dse_ldif.delete(DN_CONFIG, fake_attr)
    assert not dse_ldif.get(DN_CONFIG, fake_attr)
示例#2
0
def test_delete_multivalue(topo):
    """Check that we can delete attributes from a given suffix"""

    dse_ldif = DSEldif(topo.standalone)
    fake_attr = "fakeAttr"
    fake_attr_values = ["fake1", "fake2", "fake3"]

    log.info("Add multivalued {} to {}".format(fake_attr, DN_CONFIG))
    for value in fake_attr_values:
        dse_ldif.add(DN_CONFIG, fake_attr, value)

    log.info("Delete all values of {}".format(fake_attr))
    dse_ldif.delete(DN_CONFIG, fake_attr)
    assert not dse_ldif.get(DN_CONFIG, fake_attr)
示例#3
0
def test_delete_singlevalue(topo):
    """Check that we can delete an attribute from a given suffix"""

    dse_ldif = DSEldif(topo.standalone)
    fake_attr = "fakeAttr"
    fake_attr_values = ["fake1", "fake2", "fake3"]

    log.info("Add multivalued {} to {}".format(fake_attr, DN_CONFIG))
    for value in fake_attr_values:
        dse_ldif.add(DN_CONFIG, fake_attr, value)

    log.info("Delete {}".format(fake_attr_values[0]))
    dse_ldif.delete(DN_CONFIG, fake_attr, fake_attr_values[0])
    attr_values = dse_ldif.get(DN_CONFIG, fake_attr)
    assert len(attr_values) == 2
    assert fake_attr_values[0] not in attr_values
    assert fake_attr_values[1] in attr_values
    assert fake_attr_values[2] in attr_values

    log.info("Clean up")
    dse_ldif.delete(DN_CONFIG, fake_attr)
    assert not dse_ldif.get(DN_CONFIG, fake_attr)