Skip to content

Commit

Permalink
Test director methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktBurger committed May 16, 2024
1 parent c8833a7 commit ba40751
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/directors/test_director.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ def test_default_actor(self, director: Director):
assert director._actor_check("") == "actor"


def test_get_rpc_capabilities(director: Director):
data = {"name": "actor", "methods": []}
director.communicator._r = [ # type: ignore
Message("director", "actor", conversation_id=cid, message_type=MessageTypes.JSON, data={
"id": 1, "result": data, "jsonrpc": "2.0"
})]
result = director.get_rpc_capabilities()
assert director.communicator._s == [ # type: ignore
Message("actor", "director", conversation_id=cid, message_type=MessageTypes.JSON, data={
"id": 1, "method": "rpc.discover", "jsonrpc": "2.0"
})]
assert result == data


def test_shutdown_actor(director: Director):
director.communicator._r = [ # type: ignore
Message("director", "actor", conversation_id=cid, message_type=MessageTypes.JSON, data={
Expand All @@ -89,6 +103,18 @@ def test_shutdown_actor(director: Director):
})]


def test_set_actor_log_level(director: Director):
director.communicator._r = [ # type: ignore
Message("director", "actor", conversation_id=cid, message_type=MessageTypes.JSON, data={
"id": 1, "result": None, "jsonrpc": "2.0"
})]
director.set_actor_log_level(30)
assert director.communicator._s == [ # type: ignore
Message("actor", "director", conversation_id=cid, message_type=MessageTypes.JSON, data={
"id": 1, "method": "set_log_level", "jsonrpc": "2.0", "params": {"level": "WARNING"}
})]


def test_read_rpc_response(director: Director):
director.communicator._r = [ # type: ignore
Message("director", "actor", conversation_id=cid, message_type=MessageTypes.JSON, data={
Expand Down

0 comments on commit ba40751

Please sign in to comment.