def test_activation_with_alive_check(mock_socket): sut = DoIPClient(test_ip, test_logical_address) mock_socket.rx_queue.append(alive_check_request) mock_socket.rx_queue.append(successful_activation_response) result = sut.request_activation(0) assert result.client_logical_address == 0x0e00 assert mock_socket.tx_queue[-1] == alive_check_response
def test_send_good_activation_request_with_vm(mock_socket): sut = DoIPClient(test_ip, test_logical_address) mock_socket.rx_queue.append(successful_activation_response_with_vm) result = sut.request_activation(0, 0x01020304) assert mock_socket.tx_queue[-1] == activation_request_with_vm assert result.client_logical_address == 0x0e00 assert result.logical_address == 55 assert result.response_code == 16 assert result.vm_specific == 0x04030201
def test_activation_with_nack(mock_socket): sut = DoIPClient(test_ip, test_logical_address) mock_socket.rx_queue.append(nack_response) with pytest.raises(IOError, match=r"DoIP Negative Acknowledge. NACK Code: "): result = sut.request_activation(0)