예제 #1
0
def empty_server_name(self, timeout=60):
    """Check that empty string as a server name is not allowed.
    """
    servers = {"": {"host": "foo", "port": "389", "enable_tls": "no",
            "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com"
    }}
    invalid_server_config(servers, timeout=timeout)
예제 #2
0
def invalid_verification_cooldown_value(self, invalid_value, timeout=20):
    """Check that server returns an error when LDAP server
    verification cooldown parameter is invalid.
    """

    error_message = (
        "<Error> Access(user directories): Could not parse LDAP server"
        " \\`openldap1\\`: Poco::Exception. Code: 1000, e.code() = 0,"
        f" e.displayText() = Syntax error: Not a valid unsigned integer{': ' + invalid_value if invalid_value else invalid_value}"
    )

    with Given(
            "LDAP server configuration that uses a negative integer for the verification_cooldown parameter"
    ):
        servers = {
            "openldap1": {
                "host": "openldap1",
                "port": "389",
                "enable_tls": "no",
                "auth_dn_prefix": "cn=",
                "auth_dn_suffix": ",ou=users,dc=company,dc=com",
                "verification_cooldown": f"{invalid_value}"
            }
        }

    with When("I try to use this configuration then it should not work"):
        invalid_server_config(servers,
                              message=error_message,
                              tail=17,
                              timeout=timeout)
예제 #3
0
def invalid_verification_cooldown_value(self, invalid_value, timeout=300):
    """Check that server returns an error when LDAP server
    verification cooldown parameter is invalid.
    """

    error_message = f" Syntax error: Not a valid unsigned integer{': ' + invalid_value if invalid_value else invalid_value}"

    with Given(
            "LDAP server configuration that uses a negative integer for the verification_cooldown parameter"
    ):
        servers = {
            "openldap1": {
                "host": "openldap1",
                "port": "389",
                "enable_tls": "no",
                "auth_dn_prefix": "cn=",
                "auth_dn_suffix": ",ou=users,dc=company,dc=com",
                "verification_cooldown": f"{invalid_value}"
            }
        }

    with When("I try to use this configuration then it should not work"):
        invalid_server_config(servers,
                              message=error_message,
                              tail=30,
                              timeout=timeout)
예제 #4
0
def invalid_enable_tls_value(self, timeout=60):
    """Check that server returns an error when enable_tls
    option has invalid value.
    """
    message = "Syntax error: Cannot convert to boolean: foo"
    servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "foo",
        "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com"
    }}
    invalid_server_config(servers, message=message, tail=30, timeout=timeout)
예제 #5
0
def empty_host(self, tail=30, timeout=300):
    """Check that server returns an error when LDAP server
    host value is empty.
    """
    node = current().context.node
    message = "DB::Exception: Empty 'host' entry"

    servers = {"foo": {"host": "", "port": "389", "enable_tls": "no"}}

    invalid_server_config(servers, message=message, tail=30, timeout=timeout)
예제 #6
0
def bind_dn_conflict_with_auth_dn(self, timeout=60):
    """Check that an error is returned with both `bind_dn` and
    `auth_dn_prefix` and `auth_dn_suffix` are specified at the same time.
    """
    message = "DB::Exception: Deprecated 'auth_dn_prefix' and 'auth_dn_suffix' entries cannot be used with 'bind_dn' entry"
    servers = {
        "openldap1": {
            "host": "openldap1",
            "port": "389",
            "enable_tls": "no",
            "bind_dn": "cn={user_name},ou=users,dc=company,dc=com",
            "auth_dn_prefix": "cn=",
            "auth_dn_suffix": ",ou=users,dc=company,dc=com"
        }
    }

    invalid_server_config(servers, message=message, tail=30, timeout=timeout)