Skip to content

Commit

Permalink
removed assert_called_once from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Jul 13, 2015
1 parent 4b5ceca commit e6f1b8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_close_one_socket(self):
mock_socket = mock.MagicMock()
s.clients['foo'] = mock_socket
s.disconnect('foo')
mock_socket.close.assert_called_once()
self.assertEqual(mock_socket.close.call_count, 1)
self.assertNotIn('foo', s.clients)

def test_close_all_sockets(self):
Expand All @@ -65,7 +65,7 @@ def test_close_all_sockets(self):
s.clients[sid] = mock_sockets[sid]
s.disconnect()
for socket in six.itervalues(mock_sockets):
socket.close.assert_called_once()
self.assertEqual(socket.close.call_count, 1)
self.assertEqual(s.clients, {})

def test_upgrades(self):
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_connect(self):
start_response = mock.MagicMock()
r = s.handle_request(environ, start_response)
self.assertEqual(len(s.clients), 1)
start_response.assert_called_once()
self.assertEqual(start_response.call_count, 1)
self.assertEqual(start_response.call_args[0][0], '200 OK')
self.assertEqual(len(r), 1)
packets = payload.Payload(encoded_payload=r[0]).packets
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_send(self):
mock_socket = mock.MagicMock()
s.clients['foo'] = mock_socket
s.send('foo', 'hello')
mock_socket.send.assert_called_once()
self.assertEqual(mock_socket.send.call_count, 1)
self.assertEqual(mock_socket.send.call_args[0][0].packet_type,
packet.MESSAGE)
self.assertEqual(mock_socket.send.call_args[0][0].data, 'hello')
Expand Down

0 comments on commit e6f1b8b

Please sign in to comment.