30 lines
1009 B
Python
30 lines
1009 B
Python
"""Testing session functions."""
|
|
|
|
from unittest import IsolatedAsyncioTestCase, skip
|
|
from aiohttp import ClientSession
|
|
from release_tests.support import SESSION_KEY
|
|
from release_tests.support.cluster import Cluster
|
|
|
|
|
|
class SessionTC(IsolatedAsyncioTestCase):
|
|
"""Tests the client sessions on a single server."""
|
|
|
|
async def asyncSetUp(self):
|
|
"""Set up."""
|
|
self.cluster = Cluster()
|
|
await self.cluster.start_a_cluster()
|
|
self.addAsyncCleanup(self.cluster.cleanup)
|
|
|
|
async def test_if_session_added(self):
|
|
"""Is the session created?"""
|
|
result = await self.cluster.get("/")
|
|
self.assertIn(SESSION_KEY, result[0].cookies)
|
|
|
|
@skip("feature not yet added.")
|
|
async def test_is_session_shared(self):
|
|
"""Do all of the servers in the cluster use the same session ids?"""
|
|
results = await self.cluster.get("/")
|
|
self.assertEqual(
|
|
results[0].cookies[SESSION_KEY].value, results[1].cookies[SESSION_KEY].value
|
|
)
|