def trusted_domain(): """Fixture providing mocked AD trust entries The fixture yields after creating a mock of AD trust entries in the directory server. After the test, the entries are deleted from the directory. """ trusted_dom = TRUSTED_DOMAIN_MOCK # Write the changes with mocked_trust_containers(), MockLDAP() as ldap: ldap.add_entry(trusted_dom['dn'], trusted_dom['ldif']) yield trusted_dom ldap.del_entry(trusted_dom['dn'])
def trusted_domain_with_suffix(): """Fixture providing mocked AD trust entries The fixture yields after creating a mock of AD trust entries in the directory server. After the test, the entries are deleted from the directory. """ trusted_dom = copy.deepcopy(TRUSTED_DOMAIN_MOCK) trusted_dom['ldif']['ipaNTAdditionalSuffixes'] = (encode_mockldap_value( trusted_dom['name'])) # Write the changes with mocked_trust_containers(), MockLDAP() as ldap: ldap.add_entry(trusted_dom['dn'], trusted_dom['ldif']) yield trusted_dom ldap.del_entry(trusted_dom['dn'])
def trusted_domain_with_suffix(): """Fixture providing mocked AD trust entries The fixture yields after creating a mock of AD trust entries in the directory server. After the test, the entries are deleted from the directory. """ trusted_dom = copy.deepcopy(TRUSTED_DOMAIN_MOCK) trusted_dom['ldif']['ipaNTAdditionalSuffixes'] = ( encode_mockldap_value(trusted_dom['name']) ) # Write the changes with mocked_trust_containers(), MockLDAP() as ldap: ldap.add_entry(trusted_dom['dn'], trusted_dom['ldif']) yield trusted_dom ldap.del_entry(trusted_dom['dn'])