Skip to content

Commit

Permalink
Added first draft for test case on smoke read
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaruland committed Feb 5, 2024
1 parent 73e75f9 commit b4a1def
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tiled/_tests/test_client_smoke.py
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit b4a1def

Please sign in to comment.