def test_controller_success(self):
     payload = AgentPayload(69 * b"\0")
     header = FetcherHeader(
         FetcherType.TCP,
         PayloadType.AGENT,
         status=42,
         payload_length=len(payload),
     )
     message = FetcherMessage(header, payload)
     assert len(message) == 89
     assert make_payload_answer(message) == (
         b"fetch:SUCCESS:        :89      :" + header + payload)
Exemple #2
0
 def test_controller_success(self):
     payload = AgentPayload(69 * b"\0")
     stats = L3Stats(CPUTracker())
     header = FetcherHeader(
         FetcherType.TCP,
         PayloadType.AGENT,
         status=42,
         payload_length=len(payload),
         stats_length=len(stats),
     )
     message = FetcherMessage(header, payload, stats)
     assert make_payload_answer(message) == (b"fetch:SUCCESS:        :240     :" + header +
                                             payload + stats)
 def payload(self, header):
     return AgentPayload(b"\0" *
                         (header.payload_length - AgentPayload.length))
 def test_from_bytes_success(self, payload):
     assert AgentPayload.from_bytes(bytes(payload)) == payload
 def payload(self):
     return AgentPayload(b"<<<hello>>>\nworld")