|
1 | 1 | import asyncio
|
2 | 2 | import functools
|
| 3 | +import json |
3 | 4 | from unittest import mock
|
4 | 5 |
|
5 | 6 | import pytest
|
@@ -482,31 +483,29 @@ async def test_background_thread(self):
|
482 | 483 | host_id = self.pm.host_id
|
483 | 484 |
|
484 | 485 | async def messages():
|
485 |
| - import pickle |
486 |
| - |
487 | 486 | yield {'method': 'emit', 'value': 'foo', 'host_id': 'x'}
|
488 | 487 | yield {'missing': 'method', 'host_id': 'x'}
|
489 | 488 | yield '{"method": "callback", "value": "bar", "host_id": "x"}'
|
490 | 489 | yield {'method': 'disconnect', 'sid': '123', 'namespace': '/foo',
|
491 | 490 | 'host_id': 'x'}
|
492 | 491 | yield {'method': 'bogus', 'host_id': 'x'}
|
493 |
| - yield pickle.dumps({'method': 'close_room', 'value': 'baz', |
494 |
| - 'host_id': 'x'}) |
| 492 | + yield json.dumps({'method': 'close_room', 'value': 'baz', |
| 493 | + 'host_id': 'x'}) |
495 | 494 | yield {'method': 'enter_room', 'sid': '123', 'namespace': '/foo',
|
496 | 495 | 'room': 'room', 'host_id': 'x'}
|
497 | 496 | yield {'method': 'leave_room', 'sid': '123', 'namespace': '/foo',
|
498 | 497 | 'room': 'room', 'host_id': 'x'}
|
499 | 498 | yield 'bad json'
|
500 |
| - yield b'bad pickled' |
| 499 | + yield b'bad data' |
501 | 500 |
|
502 | 501 | # these should not publish anything on the queue, as they come from
|
503 | 502 | # the same host
|
504 | 503 | yield {'method': 'emit', 'value': 'foo', 'host_id': host_id}
|
505 | 504 | yield {'method': 'callback', 'value': 'bar', 'host_id': host_id}
|
506 | 505 | yield {'method': 'disconnect', 'sid': '123', 'namespace': '/foo',
|
507 | 506 | 'host_id': host_id}
|
508 |
| - yield pickle.dumps({'method': 'close_room', 'value': 'baz', |
509 |
| - 'host_id': host_id}) |
| 507 | + yield json.dumps({'method': 'close_room', 'value': 'baz', |
| 508 | + 'host_id': host_id}) |
510 | 509 |
|
511 | 510 | self.pm._listen = messages
|
512 | 511 | await self.pm._thread()
|
|
0 commit comments