mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
* otel can eprintln kthx * started python integration tests, features * more tests more things * adding heaps more things * updating docs * fixing python test * fixing errors, updating integration test * Add models for OAuth2, Person, ServiceAccount and add missing endpoints * Alias Group to GroupInfo to keep it retrocompatible * Fixed issues from review * adding oauth2rs_get_basic_secret * adding oauth2rs_get_basic_secret * Fixed mypy issues * adding more error logs * updating test scripts and configs * fixing tests and validating things * more errors --------- Co-authored-by: Dogeek <simon.bordeyne@gmail.com>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
""" tests the config file things """
|
|
|
|
from pathlib import Path
|
|
import sys
|
|
import toml
|
|
|
|
import pytest
|
|
|
|
from kanidm.types import KanidmClientConfig
|
|
from kanidm.utils import load_config
|
|
|
|
|
|
EXAMPLE_CONFIG_FILE = Path(__file__).parent.parent.parent / "examples/config"
|
|
|
|
def test_radius_groups() -> None:
|
|
"""testing loading a config file with radius groups defined"""
|
|
|
|
config_toml = """
|
|
radius_groups = [
|
|
{ spn = "hello world", "vlan" = 1234 },
|
|
]
|
|
|
|
"""
|
|
config_parsed = toml.loads(config_toml)
|
|
print(config_parsed)
|
|
kanidm_config = KanidmClientConfig.model_validate(config_parsed)
|
|
for group in kanidm_config.radius_groups:
|
|
print(group.spn)
|
|
assert group.spn == "hello world"
|
|
|
|
|
|
def test_radius_clients() -> None:
|
|
"""testing loading a config file with radius groups defined"""
|
|
|
|
config_toml = """
|
|
radius_clients = [ { name = "hello world", ipaddr = "10.0.0.5", secret = "cr4bj0oz" },
|
|
]
|
|
|
|
"""
|
|
config_parsed = toml.loads(config_toml)
|
|
print(config_parsed)
|
|
kanidm_config = KanidmClientConfig.model_validate(config_parsed)
|
|
client = kanidm_config.radius_clients[0]
|
|
print(client.name)
|
|
assert client.name == "hello world"
|
|
assert client.ipaddr == "10.0.0.5"
|
|
assert client.secret == "cr4bj0oz"
|