tests/test-wireproto-serverreactor.py
changeset 37726 0c184ca594bb
parent 37725 3ea8323d6f95
child 40025 b099e6032f38
equal deleted inserted replaced
37725:3ea8323d6f95 37726:0c184ca594bb
   371             b'1 2 stream-begin command-response continuation %s' % OK,
   371             b'1 2 stream-begin command-response continuation %s' % OK,
   372             b'1 2 0 command-response continuation %s' % first,
   372             b'1 2 0 command-response continuation %s' % first,
   373             b'1 2 0 command-response eos %s' % second,
   373             b'1 2 0 command-response eos %s' % second,
   374         ])
   374         ])
   375 
   375 
   376     def testapplicationerror(self):
   376     def testservererror(self):
   377         reactor = makereactor()
   377         reactor = makereactor()
   378         instream = framing.stream(1)
   378         instream = framing.stream(1)
   379         list(sendcommandframes(reactor, instream, 1, b'mycommand', {}))
   379         list(sendcommandframes(reactor, instream, 1, b'mycommand', {}))
   380 
   380 
   381         outstream = reactor.makeoutputstream()
   381         outstream = reactor.makeoutputstream()
   382         result = reactor.onapplicationerror(outstream, 1, b'some message')
   382         result = reactor.onservererror(outstream, 1, b'some message')
   383         self.assertaction(result, b'sendframes')
   383         self.assertaction(result, b'sendframes')
   384         self.assertframesequal(result[1][b'framegen'], [
   384         self.assertframesequal(result[1][b'framegen'], [
   385             b'1 2 stream-begin error-response application some message',
   385             b"1 2 stream-begin error-response 0 "
       
   386             b"cbor:{b'type': b'server', "
       
   387             b"b'message': [{b'msg': b'some message'}]}",
   386         ])
   388         ])
   387 
   389 
   388     def test1commanddeferresponse(self):
   390     def test1commanddeferresponse(self):
   389         """Responses when in deferred output mode are delayed until EOF."""
   391         """Responses when in deferred output mode are delayed until EOF."""
   390         reactor = makereactor(deferoutput=True)
   392         reactor = makereactor(deferoutput=True)