Exemple #1
0
 def test_read_unknown_response(self):
     c = Cube('127.0.0.1', 62910)
     c._socket = StaticResponseSocket([
         bytearray('X:', encoding='utf-8'),
     ])
     c.read()
     self.assertEqual(len(c.received_messages), 0)
Exemple #2
0
	def test_read_unknown_response(self):
		c = Cube('127.0.0.1', 62910)
		c._socket = StaticResponseSocket([
			bytearray('X:', encoding='utf-8'),
		])
		c.read()
		self.assertEqual(len(c.received_messages), 0)
Exemple #3
0
 def test_read(self):
     c = Cube('127.0.0.1', 62910)
     c._socket = StaticResponseSocket([
         bytearray('H:', encoding='utf-8') + HelloResponseBytes,
         bytearray('M:', encoding='utf-8') + MResponseBytes
     ])
     c.read()
     self.assertEqual(len(c.received_messages), 2)
Exemple #4
0
	def test_read(self):
		c = Cube('127.0.0.1', 62910)
		c._socket = StaticResponseSocket([
			bytearray('H:', encoding='utf-8') + HelloResponseBytes,
			bytearray('M:', encoding='utf-8') + MResponseBytes
		])
		c.read()
		self.assertEqual(len(c.received_messages), 2)
Exemple #5
0
 def test_read_after_connect(self):
     c = Cube('127.0.0.1', 62910)
     c.read = Mock()
     c._create_socket = Mock(return_value=Mock(socket.socket))
     c.connect()
     self.assertTrue(c.read.called)
Exemple #6
0
	def test_read_after_connect(self):
		c = Cube('127.0.0.1', 62910)
		c.read = Mock()
		c._create_socket = Mock(return_value=Mock(socket.socket))
		c.connect()
		self.assertTrue(c.read.called)