tests: migrate test-wireproto-serverreactor.py to our internal CBOR
authorAugie Fackler <augie@google.com>
Mon, 07 Jan 2019 18:37:50 -0500
changeset 41137 a181a1c8af1d
parent 41136 050ea8eb42a5
child 41138 785a75f0ddcb
tests: migrate test-wireproto-serverreactor.py to our internal CBOR This leaves the only client of thirdparty.cbor as test-cbor.py, which appears to be testing the behavior of cborutil against cbor. We should figure out some appropriate test strings and drop thirdparty.cbor, but that's a mission for another day. Differential Revision: https://phab.mercurial-scm.org/D5522
tests/test-wireproto-serverreactor.py
--- a/tests/test-wireproto-serverreactor.py	Mon Jan 07 16:34:04 2019 -0500
+++ b/tests/test-wireproto-serverreactor.py	Mon Jan 07 18:37:50 2019 -0500
@@ -2,9 +2,6 @@
 
 import unittest
 
-from mercurial.thirdparty import (
-    cbor,
-)
 from mercurial import (
     ui as uimod,
     util,
@@ -16,7 +13,7 @@
 
 ffs = framing.makeframefromhumanstring
 
-OK = cbor.dumps({b'status': b'ok'})
+OK = b''.join(cborutil.streamencode({b'status': b'ok'}))
 
 def makereactor(deferoutput=False):
     ui = uimod.ui()
@@ -270,20 +267,20 @@
         })
 
     def testinterleavedcommands(self):
-        cbor1 = cbor.dumps({
+        cbor1 = b''.join(cborutil.streamencode({
             b'name': b'command1',
             b'args': {
                 b'foo': b'bar',
                 b'key1': b'val',
             }
-        }, canonical=True)
-        cbor3 = cbor.dumps({
+        }))
+        cbor3 = b''.join(cborutil.streamencode({
             b'name': b'command3',
             b'args': {
                 b'biz': b'baz',
                 b'key': b'val',
             },
-        }, canonical=True)
+        }))
 
         results = list(sendframes(makereactor(), [
             ffs(b'1 1 stream-begin command-request new|more %s' % cbor1[0:6]),