def METHOD_NAME(self):
    self.reset_ldap_directory()
    user = core_factories.UserFactory(
        username=self.username,
        first_name="Test",
        last_name="LDAP",
        groups=("SimpleUsers",)
    )
    user.delete()
    ldap_record = self.conn.search_s(
        force_str(self.dn), ldap.SCOPE_SUBTREE,
        force_str("(&(objectClass=inetOrgPerson))")
    )
    password = ldap_record[0][1]["userPassword"][0].split(b"}")[1]
    self.assertTrue(password.startswith(b"#"))
    with self.assertRaises(ldap.INVALID_CREDENTIALS):
        lib.get_connection(self.config, self.dn, "toto")
    user = core_factories.UserFactory(
        username=self.username,
        first_name="Test",
        last_name="LDAP",
        groups=("SimpleUsers",)
    )
    self.set_global_parameter(
        "ldap_sync_delete_remote_account", True, app="core")
    user.delete()
    self.assertFalse(lib.check_if_dn_exists(self.conn, self.dn))