|
|
|
|
|
|
|
|
return _test(client1, client2) |
|
|
return _test(client1, client2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_private_message(): |
|
|
|
|
|
client1 = _make_client('ws://localhost:8642/', 0.10, Script() |
|
|
|
|
|
+ {'action': 'login', 'username': 'Norman'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Norman'], 'info': 'Welcome to /', 'username': 'Norman'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Norman', 'Ray'], 'info': 'Ray joined'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Emma', 'Norman', 'Ray'], 'info': 'Emma joined'} |
|
|
|
|
|
+ {'action': 'post', 'target': 'Emma', 'text': 'なに?'} |
|
|
|
|
|
- {'kind': 'post', 'source': 'Norman', 'text': 'なに?'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Norman', 'Ray'], 'info': 'Emma left'} |
|
|
|
|
|
) |
|
|
|
|
|
client2 = _make_client('ws://localhost:8642/', 0.11, Script() |
|
|
|
|
|
+ {'action': 'login', 'username': 'Ray'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Norman', 'Ray'], 'info': 'Welcome to /', 'username': 'Ray'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Emma', 'Norman', 'Ray'], 'info': 'Emma joined'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Norman', 'Ray'], 'info': 'Emma left'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Ray'], 'info': 'Norman left'} |
|
|
|
|
|
) |
|
|
|
|
|
client3 = _make_client('ws://localhost:8642/', 0.12, Script() |
|
|
|
|
|
+ {'action': 'login', 'username': 'Emma'} |
|
|
|
|
|
- {'kind': 'update', 'users': ['Emma', 'Norman', 'Ray'], 'info': 'Welcome to /', 'username': 'Emma'} |
|
|
|
|
|
- {'kind': 'post', 'source': 'Norman', 'text': 'なに?'} |
|
|
|
|
|
) |
|
|
|
|
|
return _test(client1, client2, client3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
loop = asyncio.get_event_loop() |
|
|
loop = asyncio.get_event_loop() |
|
|
for fn_name, fn in list(locals().items()): |
|
|
for fn_name, fn in list(locals().items()): |