コード例 #1
0
def test_search_access_should_not_include_read_access(topo, clean, aci_of_user):
    """
    bug 345643
    Misc Test 4 search access should not include read access
    :id:98ab173e-7db8-11e8-a309-8c16451d917b
    :setup: Standalone Instance
    :steps:
        1. Add test entry
        2. Add ACI
        3. User should follow ACI role
    :expectedresults:
        1. Entry should be added
        2. Operation should  succeed
        3. Operation should  succeed
    """
    assert Domain(topo.standalone, DEFAULT_SUFFIX).present('aci')
    Domain(topo.standalone, DEFAULT_SUFFIX)\
        .add("aci", [f'(target ="ldap:///{DEFAULT_SUFFIX}")(targetattr !="userPassword")'
                     '(version 3.0;acl "anonymous access";allow (search)'
                     '(userdn = "ldap:///anyone");)',
                     f'(target="ldap:///{DEFAULT_SUFFIX}") (targetattr = "*")(version 3.0; '
                     'acl "allow self write";allow(write) '
                     'userdn = "ldap:///self";)',
                     f'(target="ldap:///{DEFAULT_SUFFIX}") (targetattr = "*")(version 3.0; '
                     'acl "Allow all admin group"; allow(all) groupdn = "ldap:///cn=Directory '
                     'Administrators, {}";)'])

    conn = Anonymous(topo.standalone).bind()
    # search_access_should_not_include_read_access
    suffix = Domain(conn, DEFAULT_SUFFIX)
    with pytest.raises(AssertionError):
        assert suffix.present('aci')
コード例 #2
0
def test_changes(topology):
    """Test the changes counter behaviour after making some changes
    to the replicated suffix
    """

    topology.supplier.log.info("\n\n##########\n### CHANGES\n##########")
    ents = topology.supplier.agreement.list(suffix=SUFFIX,
                                            consumer_host=topology.consumer.host,
                                            consumer_port=topology.consumer.port)
    assert len(ents) == 1
    value = topology.supplier.agreement.changes(agmnt_dn=ents[0].dn)
    topology.supplier.log.info("\ntest_changes: %d changes\n" % value)
    assert value > 0

    # Do an update
    TEST_STRING = 'test_string'
    supplier_domain = Domain(topology.supplier, SUFFIX)
    consumer_domain = Domain(topology.consumer, SUFFIX)

    supplier_domain.set('description', TEST_STRING)

    # The update has been replicated
    loop = 0
    while loop <= 10:
        if consumer_domain.present('description', TEST_STRING):
            break
        time.sleep(1)
        loop += 1
    assert loop <= 10

    # Give a little time to update a change number on supplier
    time.sleep(2)

    # Check change number
    newvalue = topology.supplier.agreement.changes(agmnt_dn=ents[0].dn)
    topology.supplier.log.info("\ntest_changes: %d changes\n" % newvalue)
    assert (value + 1) == newvalue