[Python-modules-commits] [python-ws4py] 17/20: Fix tests
Stein Magnus Jodal
jodal at moszumanska.debian.org
Thu Nov 5 14:59:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
jodal pushed a commit to branch master
in repository python-ws4py.
commit a7d5ce7c1e8d39c2e68eeb6ef5bab72b3981dc37
Author: Stein Magnus Jodal <jodal at debian.org>
Date: Thu Nov 5 15:46:08 2015 +0100
Fix tests
Based on upstream commits:
- b5d47f7b3497f1b713a20fe6306b7d9afdd8c408
- b2a76a33960040d7d3d27c68bf17c12f169f81c7
---
test/test_manager.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/test_manager.py b/test/test_manager.py
index 8c229b0..da57d44 100644
--- a/test/test_manager.py
+++ b/test/test_manager.py
@@ -16,10 +16,10 @@ class WSManagerTest(unittest.TestCase):
ws.sock.fileno.return_value = 1
m.add(ws)
- m.poller.register.assert_call_once_with(ws)
+ m.poller.register.assert_called_once_with(1)
m.remove(ws)
- m.poller.unregister.assert_call_once_with(ws)
+ m.poller.unregister.assert_called_once_with(1)
@patch('ws4py.manager.SelectPoller')
def test_cannot_add_websocket_more_than_once(self, MockSelectPoller):
@@ -49,7 +49,7 @@ class WSManagerTest(unittest.TestCase):
self.assertEqual(len(m), 1)
m.remove(ws)
self.assertEqual(len(m), 0)
- m.poller.unregister.assert_call_once_with(ws)
+ m.poller.unregister.assert_called_once_with(1)
m.poller.reset_mock()
m.remove(ws)
@@ -97,8 +97,9 @@ class WSManagerTest(unittest.TestCase):
m.add(ws)
m.start()
+ time.sleep(0.2)
- ws.terminate.assert_call_once_with()
+ ws.terminate.assert_called_once_with()
m.stop()
@@ -109,7 +110,7 @@ class WSManagerTest(unittest.TestCase):
ws = MagicMock()
m.add(ws)
m.close_all()
- ws.terminate.assert_call_once_with(1001, 'Server is shutting down')
+ ws.close.assert_called_once_with(code=1001, reason='Server is shutting down')
@patch('ws4py.manager.SelectPoller')
def test_broadcast(self, MockSelectPoller):
@@ -120,7 +121,7 @@ class WSManagerTest(unittest.TestCase):
m.add(ws)
m.broadcast(b'hello there')
- ws.send.assert_call_once_with(b'hello there')
+ ws.send.assert_called_once_with(b'hello there', False)
@patch('ws4py.manager.SelectPoller')
def test_broadcast_failure_must_not_break_caller(self, MockSelectPoller):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-ws4py.git
More information about the Python-modules-commits
mailing list