|
1 | 1 | import functools
|
| 2 | +import json |
2 | 3 | import logging
|
3 | 4 | from unittest import mock
|
4 | 5 |
|
@@ -465,30 +466,28 @@ def test_background_thread(self):
|
465 | 466 | host_id = self.pm.host_id
|
466 | 467 |
|
467 | 468 | def messages():
|
468 |
| - import pickle |
469 |
| - |
470 | 469 | yield {'method': 'emit', 'value': 'foo', 'host_id': 'x'}
|
471 | 470 | yield {'missing': 'method', 'host_id': 'x'}
|
472 | 471 | yield '{"method": "callback", "value": "bar", "host_id": "x"}'
|
473 | 472 | yield {'method': 'disconnect', 'sid': '123', 'namespace': '/foo',
|
474 | 473 | 'host_id': 'x'}
|
475 | 474 | yield {'method': 'bogus', 'host_id': 'x'}
|
476 |
| - yield pickle.dumps({'method': 'close_room', 'value': 'baz', |
| 475 | + yield json.dumps({'method': 'close_room', 'value': 'baz', |
477 | 476 | 'host_id': 'x'})
|
478 | 477 | yield {'method': 'enter_room', 'sid': '123', 'namespace': '/foo',
|
479 | 478 | 'room': 'room', 'host_id': 'x'}
|
480 | 479 | yield {'method': 'leave_room', 'sid': '123', 'namespace': '/foo',
|
481 | 480 | 'room': 'room', 'host_id': 'x'}
|
482 | 481 | yield 'bad json'
|
483 |
| - yield b'bad pickled' |
| 482 | + yield b'bad data' |
484 | 483 |
|
485 | 484 | # these should not publish anything on the queue, as they come from
|
486 | 485 | # the same host
|
487 | 486 | yield {'method': 'emit', 'value': 'foo', 'host_id': host_id}
|
488 | 487 | yield {'method': 'callback', 'value': 'bar', 'host_id': host_id}
|
489 | 488 | yield {'method': 'disconnect', 'sid': '123', 'namespace': '/foo',
|
490 | 489 | 'host_id': host_id}
|
491 |
| - yield pickle.dumps({'method': 'close_room', 'value': 'baz', |
| 490 | + yield json.dumps({'method': 'close_room', 'value': 'baz', |
492 | 491 | 'host_id': host_id})
|
493 | 492 |
|
494 | 493 | self.pm._listen = mock.MagicMock(side_effect=messages)
|
|
0 commit comments