Commit c7d4354a authored by Jan-Niklas Burfeind's avatar Jan-Niklas Burfeind Committed by oroulet

test: Migrate and reactivate old unittest for shelf loading

Mark it as expexted to fail similar to the early return contained before.
parent 26bf7386
...@@ -3,6 +3,9 @@ Run common tests on server side ...@@ -3,6 +3,9 @@ Run common tests on server side
Tests that can only be run on server side must be defined here Tests that can only be run on server side must be defined here
""" """
import asyncio import asyncio
import shelve
from pathlib import Path
import pytest import pytest
import logging import logging
from datetime import timedelta from datetime import timedelta
...@@ -777,30 +780,24 @@ async def test_message_limits_works(restore_transport_limits_server: Server): ...@@ -777,30 +780,24 @@ async def test_message_limits_works(restore_transport_limits_server: Server):
await n.read_value() await n.read_value()
""" @pytest.mark.xfail(reason="FIXME broken", strict=True)
class TestServerCaching(unittest.TestCase): async def test_runTest(tmp_path: Path):
def runTest(self): demo_shelf_file: Path = tmp_path / "some_shelf"
return # FIXME broken
tmpfile = NamedTemporaryFile()
path = tmpfile.name
tmpfile.close()
# create cache file
server = Server(shelffile=path)
# modify cache content
id = ua.NodeId(ua.ObjectIds.Server_ServerStatus_SecondsTillShutdown)
s = shelve.open(path, "w", writeback=True)
s[id.to_string()].attributes[ua.AttributeIds.Value].value = ua.DataValue(123)
s.close()
# ensure that we are actually loading from the cache # create cache file
server = Server(shelffile=path) server = Server()
assert server.get_node(id).read_value(), 123) await server.init(shelf_file=demo_shelf_file)
os.remove(path) # modify cache content
id = ua.NodeId(ua.ObjectIds.Server_ServerStatus_SecondsTillShutdown)
s = shelve.open(str(demo_shelf_file), "w", writeback=True)
s[id.to_string()].attributes[ua.AttributeIds.Value].value = ua.DataValue(123)
s.close()
""" # ensure that we are actually loading from the cache
server = Server()
await server.init(shelf_file=demo_shelf_file)
assert await server.get_node(id).read_value() == 123
async def test_null_auth(server): async def test_null_auth(server):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment