Files
cariflex/tools/shapeshifter-library-python-main/test/test_message_destination.py
Eric F d398a6ced2 Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
2026-06-08 00:38:27 -04:00

45 lines
1.2 KiB
Python

import pytest
from shapeshifter_uftp import (
FlexMessage,
PayloadMessage,
PayloadMessageResponse,
ShapeshifterAgrService,
ShapeshifterCroService,
ShapeshifterDsoService,
TestMessage,
TestMessageResponse,
uftp,
)
from shapeshifter_uftp.uftp import destination_map
@pytest.mark.parametrize(
"message_cls",
[
getattr(uftp, message_cls)
for message_cls in dir(uftp)
if isinstance(getattr(uftp, message_cls), type)
and PayloadMessage in getattr(uftp, message_cls).__mro__
and getattr(uftp, message_cls) not in (
PayloadMessage,
PayloadMessageResponse,
TestMessage,
TestMessageResponse,
FlexMessage,
)
],
)
def test_all_messages_have_destination(message_cls):
assert message_cls in destination_map
@pytest.mark.parametrize("message_cls,destination", destination_map.items())
def test_message_destination(message_cls, destination):
service_map = {
"AGR": ShapeshifterAgrService,
"CRO": ShapeshifterCroService,
"DSO": ShapeshifterDsoService,
}
assert message_cls in service_map[destination].acceptable_messages