mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
* added python kanidm module * rewrote RADIUS integration * updated the documentation * updating github actions to run more often * BLEEP BLOOP ASYNCIO IS GR8 * adding config to makefile to run pykanidm tests Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Firstyear <william@blackhats.net.au>
37 lines
938 B
Python
37 lines
938 B
Python
""" testing session header function """
|
|
|
|
import pytest
|
|
|
|
import aiohttp.client_exceptions
|
|
from testutils import client
|
|
|
|
from kanidm import KanidmClient
|
|
|
|
|
|
def test_session_header(client: KanidmClient) -> None:
|
|
"""tests the session_header function"""
|
|
|
|
with pytest.raises(ValueError):
|
|
client.session_header()
|
|
|
|
assert client.session_header("testval") == {
|
|
"X-KANIDM-AUTH-SESSION-ID": "testval",
|
|
}
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_session_creator(client: KanidmClient) -> None:
|
|
"""tests the session_header function"""
|
|
|
|
client.session = None
|
|
client.config.uri = "🦀"
|
|
with pytest.raises(aiohttp.client_exceptions.InvalidURL):
|
|
await client._call(method="GET", path="/") # pylint: disable=protected-access
|
|
|
|
# pytest.raises(ValueError):
|
|
# client.session_header()
|
|
|
|
# assert client.session_header("testval") == {
|
|
# "X-KANIDM-AUTH-SESSION-ID": "testval",
|
|
# }
|