adds cache test for task status update

This commit is contained in:
Mose Müller 2023-11-16 10:22:13 +01:00
parent a83e0c6c7f
commit ebb8b4be8b

View File

@ -23,3 +23,20 @@ def test_nested_attributes_cache_callback() -> None:
test_service.class_attr.name = "Ciao"
assert get_nested_dict_by_path(cache.cache, "class_attr.name")["value"] == "Ciao"
def test_task_status_update() -> None:
class ServiceClass(pydase.DataService):
name = "World"
async def my_method(self) -> None:
pass
test_service = ServiceClass()
cache = DataServiceCache(test_service)
assert get_nested_dict_by_path(cache.cache, "my_method")["type"] == "method"
assert get_nested_dict_by_path(cache.cache, "my_method")["value"] is None
test_service.start_my_method() # type: ignore
assert get_nested_dict_by_path(cache.cache, "my_method")["type"] == "method"
assert get_nested_dict_by_path(cache.cache, "my_method")["value"] == {}