Exemplo n.º 1
0
 def test_requests_are_stored(self):
     client = ClientComms("c", Mock())
     client._current_id = 1234
     request = Mock()
     client.send_to_server = Mock()
     client.q.get = Mock(side_effect = [request, CLIENT_STOP])
     client.send_loop()
     expected = OrderedDict({1234 : request})
     self.assertEquals(expected, client.requests)
 def test_request_id_provided(self):
     client = ClientComms(Mock())
     client._current_id = 1234
     client.send_to_server = Mock()
     request_1 = Mock(id=None)
     request_2 = Mock(id=None)
     client.q.get = Mock(side_effect=[request_1, request_2, client.STOP])
     client.send_loop()
     request_1.set_id.assert_called_once_with(1234)
     request_2.set_id.assert_called_once_with(1235)
Exemplo n.º 3
0
 def test_request_id_provided(self):
     client = ClientComms("c", Mock())
     client._current_id = 1234
     client.send_to_server = Mock()
     request_1 = Mock(id_ = None)
     request_2 = Mock(id_ = None)
     client.q.get = Mock(side_effect = [request_1, request_2, client.STOP])
     client.send_loop()
     request_1.set_id.assert_called_once_with(1234)
     request_2.set_id.assert_called_once_with(1235)
Exemplo n.º 4
0
 def test_request_id_provided(self):
     client = ClientComms("c", Mock())
     client._current_id = 1234
     client.send_to_server = Mock()
     request_1 = Mock(id_ = None)
     request_2 = Mock(id_ = None)
     client.q.get = Mock(side_effect = [request_1, request_2, CLIENT_STOP])
     client.send_loop()
     self.assertEqual(1234, request_1.id_)
     self.assertEqual(1235, request_2.id_)