Beispiel #1
0
def test_add_membership_attr_with_value_that_already_exists(topology):
    plugin = ReferentialIntegrityPlugin(topology.standalone)
    # setup test
    if not "uniqueMember" in plugin.get_membership_attr():
        plugin.add_membership_attr("uniqueMember")

    args = FakeArgs()

    args.value = "uniqueMember"
    referint_cli.add_membership_attr(topology.standalone, None, topology.logcap.log, args)
    assert topology.logcap.contains("already exists")
    topology.logcap.flush()
Beispiel #2
0
def test_try_remove_all_membership_attr_values(topology):
    plugin = ReferentialIntegrityPlugin(topology.standalone)
    #setup test
    membership_values = plugin.get_membership_attr()
    assert len(membership_values) > 0
    for val in membership_values[:-1]:
        plugin.remove_membership_attr(val)

    args = FakeArgs()

    args.value = membership_values[-1]
    referint_cli.remove_membership_attr(topology.standalone, None, topology.logcap.log, args)
    assert topology.logcap.contains("Error: Failed to delete. At least one value for membership attribute should exist.")
    topology.logcap.flush()
Beispiel #3
0
def test_remove_membership_attr_with_value_that_exists(topology):
    plugin = ReferentialIntegrityPlugin(topology.standalone)
    # setup test
    if not "uniqueMember" in plugin.get_membership_attr():
        plugin.add_membership_attr("uniqueMember")

    args = FakeArgs()

    args.value = "uniqueMember"
    referint_cli.remove_membership_attr(topology.standalone, None, topology.logcap.log, args)
    assert topology.logcap.contains("successfully removed membership attribute")
    topology.logcap.flush()

    referint_cli.display_membership_attr(topology.standalone, None, topology.logcap.log, args)
    assert not topology.logcap.contains(": uniqueMember")
    topology.logcap.flush()