From 4e42da1d8c7380c738d3fda39806bb96d738ab61 Mon Sep 17 00:00:00 2001 From: Juan Marulanda Date: Mon, 5 Feb 2024 12:47:39 -0500 Subject: [PATCH] Added first draft for test case on smoke read --- tiled/_tests/test_client_smoke.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tiled/_tests/test_client_smoke.py diff --git a/tiled/_tests/test_client_smoke.py b/tiled/_tests/test_client_smoke.py new file mode 100644 index 000000000..3be3ed28c --- /dev/null +++ b/tiled/_tests/test_client_smoke.py @@ -0,0 +1,28 @@ +import collections + +import pytest + +from ..adapters.array import ArrayAdapter +from ..adapters.mapping import MapAdapter +from ..client import Context, from_context +from ..client.smoke import read +from ..server.app import build_app + + +def f(): + raise Exception("test!") + + +def test_smoke_read(): + data = collections.defaultdict(f) + data["A"] = ArrayAdapter.from_array([1, 2, 3], metadata={"A": "a"}) + + tree = MapAdapter(data) + with Context.from_app(build_app(tree)) as context: + client = from_context(context) + + faulty_list = read(client) + assert len(faulty_list) == 1 + + with pytest.raises(Exception): + data["B"]