예제 #1
0
파일: cube.py 프로젝트: ercpe/pymax
	def test_network_config_discover(self):
		send_socket = self._create_fake_send_socket()
		recv_socket = self._create_fake_receive_socket(DiscoveryNetworkConfigResponseBytes)

		d = Discovery()
		d._create_send_socket = Mock(return_value=send_socket)
		d._create_receive_socket = Mock(return_value=recv_socket)

		response = d.discover("KEQ0523864", Discovery.DISCOVERY_TYPE_NETWORK_CONFIG)
		send_socket.sendto.assert_called_with(DiscoveryNetworkConfigRequestBytes, ("255.255.255.255", 23272))
		self.assertEqual(response, DiscoveryNetworkConfigurationResponse(DiscoveryNetworkConfigResponseBytes))

		self.assertTrue(send_socket.close.called)
		self.assertTrue(recv_socket.close.called)
예제 #2
0
파일: cube.py 프로젝트: ercpe/pymax
	def test_identify_discover(self):
		send_socket = self._create_fake_send_socket()
		recv_socket = self._create_fake_receive_socket(DiscoveryIdentifyResponseBytes)

		d = Discovery()
		d._create_send_socket = Mock(return_value=send_socket)
		d._create_receive_socket = Mock(return_value=recv_socket)

		response = d.discover()
		send_socket.sendto.assert_called_with(DiscoveryIdentifyRequestBytes, ("255.255.255.255", 23272))
		self.assertEqual(response, DiscoveryIdentifyResponse(DiscoveryIdentifyResponseBytes))

		self.assertTrue(send_socket.close.called)
		self.assertTrue(recv_socket.close.called)
예제 #3
0
    def test_identify_discover(self):
        send_socket = self._create_fake_send_socket()
        recv_socket = self._create_fake_receive_socket(
            DiscoveryIdentifyResponseBytes)

        d = Discovery()
        d._create_send_socket = Mock(return_value=send_socket)
        d._create_receive_socket = Mock(return_value=recv_socket)

        response = d.discover()
        send_socket.sendto.assert_called_with(DiscoveryIdentifyRequestBytes,
                                              ("255.255.255.255", 23272))
        self.assertEqual(
            response,
            DiscoveryIdentifyResponse(DiscoveryIdentifyResponseBytes))

        self.assertTrue(send_socket.close.called)
        self.assertTrue(recv_socket.close.called)
예제 #4
0
    def test_network_config_discover(self):
        send_socket = self._create_fake_send_socket()
        recv_socket = self._create_fake_receive_socket(
            DiscoveryNetworkConfigResponseBytes)

        d = Discovery()
        d._create_send_socket = Mock(return_value=send_socket)
        d._create_receive_socket = Mock(return_value=recv_socket)

        response = d.discover("KEQ0523864",
                              Discovery.DISCOVERY_TYPE_NETWORK_CONFIG)
        send_socket.sendto.assert_called_with(
            DiscoveryNetworkConfigRequestBytes, ("255.255.255.255", 23272))
        self.assertEqual(
            response,
            DiscoveryNetworkConfigurationResponse(
                DiscoveryNetworkConfigResponseBytes))

        self.assertTrue(send_socket.close.called)
        self.assertTrue(recv_socket.close.called)