2024-09-10 02:36:50 +02:00
|
|
|
"""testing session header function"""
|
2022-06-20 12:16:55 +02:00
|
|
|
|
|
|
|
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"""
|
2023-08-23 05:55:08 +02:00
|
|
|
sessionid = "testval"
|
|
|
|
assert client.session_header(sessionid) == {
|
|
|
|
"authorization": f"bearer {sessionid}",
|
2022-06-20 12:16:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
|
|
async def test_session_creator(client: KanidmClient) -> None:
|
|
|
|
"""tests the session_header function"""
|
|
|
|
|
|
|
|
client.config.uri = "🦀"
|
|
|
|
with pytest.raises(aiohttp.client_exceptions.InvalidURL):
|
|
|
|
await client._call(method="GET", path="/") # pylint: disable=protected-access
|