tests/ldap: check regex match return value
error[unresolved-attribute]: Attribute `group` is not defined on `None` in union `Match[str] | None`
--> testScriptWithTypes:152:21
|
152 | ldap_table_path = re.match('.* =.*ldap:(.*)', conf).group(1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
This commit is contained in:
+4
-1
@@ -198,7 +198,10 @@ in
|
||||
# to the expected value.
|
||||
def test_lookup(postconf_cmdline, key, expected):
|
||||
conf = machine.succeed(postconf_cmdline).rstrip()
|
||||
ldap_table_path = re.match('.* =.*ldap:(.*)', conf).group(1)
|
||||
ldap_table_path_match = re.match('.* =.*ldap:(.*)', conf)
|
||||
if not ldap_table_path_match:
|
||||
raise RuntimeError(f"Failed to match LDAP table in '{postconf_cmdline}' response")
|
||||
ldap_table_path = ldap_table_path_match.group(1)
|
||||
value = machine.succeed(f"postmap -q {key} ldap:{ldap_table_path}").rstrip()
|
||||
try:
|
||||
assert value == expected
|
||||
|
||||
Reference in New Issue
Block a user