diff --git a/tests/software_tests/can/test_mixed_addressing_information.py b/tests/software_tests/can/test_mixed_addressing_information.py index 59e42501..75de2f42 100644 --- a/tests/software_tests/can/test_mixed_addressing_information.py +++ b/tests/software_tests/can/test_mixed_addressing_information.py @@ -136,6 +136,7 @@ def test_validate_packet_ai__missing_info(self, addressing_type, can_id, @pytest.mark.parametrize("address_extension", ["some AE", 0x5B]) def test_validate_packet_ai__inconsistent_can_id_ta_sa(self, can_id, addressing_type, decoded_addressing_type, ta, decoded_ta, sa, decoded_sa, address_extension): + self.mock_validate_addressing_type.return_value = addressing_type self.mock_can_id_handler_class.decode_mixed_addressed_29bit_can_id.return_value = { self.mock_can_id_handler_class.ADDRESSING_TYPE_NAME: decoded_addressing_type, self.mock_can_id_handler_class.TARGET_ADDRESS_NAME: decoded_ta, @@ -164,7 +165,7 @@ def test_validate_packet_ai__valid_without_can_id(self, addressing_type, source_address=source_address, address_extension=address_extension) == { AbstractCanAddressingInformation.ADDRESSING_FORMAT_NAME: CanAddressingFormat.MIXED_29BIT_ADDRESSING, - AbstractCanAddressingInformation.ADDRESSING_TYPE_NAME: addressing_type, + AbstractCanAddressingInformation.ADDRESSING_TYPE_NAME: self.mock_validate_addressing_type.return_value, AbstractCanAddressingInformation.CAN_ID_NAME: self.mock_can_id_handler_class.encode_mixed_addressed_29bit_can_id.return_value, AbstractCanAddressingInformation.TARGET_ADDRESS_NAME: target_address, AbstractCanAddressingInformation.SOURCE_ADDRESS_NAME: source_address, @@ -176,7 +177,7 @@ def test_validate_packet_ai__valid_without_can_id(self, addressing_type, self.mock_can_id_handler_class.validate_can_id.assert_not_called() self.mock_can_id_handler_class.decode_mixed_addressed_29bit_can_id.assert_not_called() self.mock_can_id_handler_class.encode_mixed_addressed_29bit_can_id.assert_called_once_with( - addressing_type=addressing_type, + addressing_type=self.mock_validate_addressing_type.return_value, target_address=target_address, source_address=source_address) @@ -193,7 +194,7 @@ def test_validate_packet_ai__valid_with_can_id(self, addressing_type, can_id, decoded_target_address = target_address or "ta" decoded_source_address = source_address or "sa" self.mock_can_id_handler_class.decode_mixed_addressed_29bit_can_id.return_value = { - self.mock_can_id_handler_class.ADDRESSING_TYPE_NAME: addressing_type, + self.mock_can_id_handler_class.ADDRESSING_TYPE_NAME: self.mock_validate_addressing_type.return_value, self.mock_can_id_handler_class.TARGET_ADDRESS_NAME: decoded_target_address, self.mock_can_id_handler_class.SOURCE_ADDRESS_NAME: decoded_source_address, } @@ -203,7 +204,7 @@ def test_validate_packet_ai__valid_with_can_id(self, addressing_type, can_id, source_address=source_address, address_extension=address_extension) == { AbstractCanAddressingInformation.ADDRESSING_FORMAT_NAME: CanAddressingFormat.MIXED_29BIT_ADDRESSING, - AbstractCanAddressingInformation.ADDRESSING_TYPE_NAME: addressing_type, + AbstractCanAddressingInformation.ADDRESSING_TYPE_NAME: self.mock_validate_addressing_type.return_value, AbstractCanAddressingInformation.CAN_ID_NAME: can_id, AbstractCanAddressingInformation.TARGET_ADDRESS_NAME: decoded_target_address, AbstractCanAddressingInformation.SOURCE_ADDRESS_NAME: decoded_source_address, diff --git a/tests/software_tests/can/test_normal_addressing_information.py b/tests/software_tests/can/test_normal_addressing_information.py index d9ccae0c..100c7e2e 100644 --- a/tests/software_tests/can/test_normal_addressing_information.py +++ b/tests/software_tests/can/test_normal_addressing_information.py @@ -136,6 +136,7 @@ def test_validate_packet_ai__missing_info(self, addressing_type, can_id, ]) def test_validate_packet_ai__inconsistent_can_id_ta_sa(self, can_id, addressing_type, decoded_addressing_type, ta, decoded_ta, sa, decoded_sa): + self.mock_validate_addressing_type.return_value = addressing_type self.mock_can_id_handler_class.decode_normal_fixed_addressed_can_id.return_value = { self.mock_can_id_handler_class.ADDRESSING_TYPE_NAME: decoded_addressing_type, self.mock_can_id_handler_class.TARGET_ADDRESS_NAME: decoded_ta, diff --git a/uds/can/mixed_addressing_information.py b/uds/can/mixed_addressing_information.py index a862765e..c1db6903 100644 --- a/uds/can/mixed_addressing_information.py +++ b/uds/can/mixed_addressing_information.py @@ -92,7 +92,7 @@ def validate_packet_ai(cls, :return: Normalized dictionary with the provided Addressing Information. """ - AddressingType.validate_member(addressing_type) + addressing_type = AddressingType.validate_member(addressing_type) validate_raw_byte(address_extension) # type: ignore if can_id is None: if None in (target_address, source_address):