Skip to content

Commit

Permalink
fix adjustment config usage
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Klemm <[email protected]>
  • Loading branch information
klemmpnx committed Nov 9, 2023
1 parent 9157df9 commit bc52530
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ def adjust_ocpp_configuration(self, config: dict) -> dict:
pass


class OCPPConfigAdjustmentWrapper(OCPPConfigAdjustmentVisitor):
class OCPPConfigAdjustmentVisitorWrapper(OCPPConfigAdjustmentVisitor):
""" Simple OCPPConfigAdjustmentVisitor from a callback function.
"""

def __init__(self, callback: Callable[[dict], dict]):
self._callback = callback

@abstractmethod
def adjust_ocpp_configuration(self, config: dict) -> dict:
""" Adjusts the provided configuration by making a (deep) copy and returning the adjusted configuration. """
config = deepcopy(config)
Expand Down Expand Up @@ -66,7 +65,7 @@ def adjust_ocpp_configuration(config: dict) -> dict:
"CentralSystemURI"] = f"{central_system_host}:{central_system_port}/{charge_point_id}"
return config

return OCPPConfigAdjustmentWrapper(adjust_ocpp_configuration)
return OCPPConfigAdjustmentVisitorWrapper(adjust_ocpp_configuration)


class _DefaultOCPP201ConfigurationVisitor(OCPPConfigAdjustmentVisitor):
Expand Down
2 changes: 1 addition & 1 deletion everest-testing/src/everest/testing/ocpp_utils/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def ocpp_config(request, central_system: CentralSystem, test_config: OcppTestCon
for v in ocpp_configuration_visitors_marker.args:
assert hasattr(v,
"adjust_ocpp_configuration"), "Arguments to 'ocpp_config_adaptions' must all provide interface of OCPPConfigAdjustmentVisitor"
ocpp_configuration_visitors_marker.append(v)
ocpp_configuration_visitors.append(v)

return EverestEnvironmentOCPPConfiguration(
central_system_port=central_system.port,
Expand Down

0 comments on commit bc52530

Please sign in to comment.