コード例 #1
0
def test_frame_to_json():
    uuid = uuid4().hex
    frame_as_dict = {'name': 'test-frame', 'uuid': uuid, 'kind': Kind.EVENT}
    f = Frame('test-frame', uuid=uuid)
    fjson = f.to_json()
    fdict = json.loads(fjson)
    assert fdict == frame_as_dict
コード例 #2
0
 async def send_to_space(self, frame: Frame, space: Space):
     add_space_to_meta(frame, space_name=space.name, space_uuid=space.uuid)
     await self.publisher.publish(space.uuid, frame.to_json())
コード例 #3
0
 async def send_to_agent(self, frame: Frame, agent: Agent):
     if agent.uuid not in self.agent_servers:
         raise KeyError(f'Agent {agent.name} is not connected?')
     await self.publisher.publish(agent.uuid, frame.to_json())