Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cost and price display message tests #975

Merged
merged 10 commits into from
Dec 16, 2024

Conversation

maaikez
Copy link
Contributor

@maaikez maaikez commented Nov 28, 2024

Describe your changes

Add python integration tests for california pricing and display message.

Bugfix found by adding the tests: EVerest/libocpp#899

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

@@ -67,7 +67,7 @@ libevse-security:
# OCPP
libocpp:
git: https://github.com/EVerest/libocpp.git
git_tag: 9836ac4766e99a79555adb15c3001c8704f8b7a7
git_tag: bugfix/meter-value-pricing-trigger
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be set back to the correct version as soon as it the bugfix (EVerest/libocpp#899) is merged.

@maaikez maaikez force-pushed the feature/cost_and_price_display_message_tests branch 2 times, most recently from cc61cbf to 2b40e7a Compare December 5, 2024 09:00
Copy link
Contributor

@Pietfried Pietfried left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm except a few inline comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests should go into a seperate file like california_pricing.py like for ocpp201

Comment on lines 6608 to 6656
@pytest_asyncio.fixture
async def chargepoint_with_pm(central_system: CentralSystem, probe_module: ProbeModule):
"""Fixture for ChargePoint16. Requires central_system_v201 and test_controller. Starts test_controller immediately
"""
# wait for libocpp to go online
cp = await central_system.wait_for_chargepoint()
yield cp
await cp.stop()


class ProbeModuleCostAndPriceMetervaluesConfigurationAdjustment(EverestConfigAdjustmentStrategy):
"""
Probe module to be able to 'inject' metervalues
"""
def adjust_everest_configuration(self, everest_config: Dict):
adjusted_config = deepcopy(everest_config)

adjusted_config["active_modules"]["grid_connection_point"]["connections"]["powermeter"] = [
{"module_id": "probe", "implementation_id": "ProbeModulePowerMeter"}]
adjusted_config["active_modules"]["evse_manager"]["connections"]["powermeter_grid_side"] = [
{"module_id": "probe", "implementation_id": "ProbeModulePowerMeter"}]

return adjusted_config


class ProbeModuleCostAndPriceDisplayMessageConfigurationAdjustment(EverestConfigAdjustmentStrategy):
"""
Probe module to be able to mock display messages
"""
def adjust_everest_configuration(self, everest_config: Dict):
adjusted_config = deepcopy(everest_config)

adjusted_config["active_modules"]["ocpp"]["connections"]["display_message"] = [
{"module_id": "probe", "implementation_id": "ProbeModuleDisplayMessage"}]

return adjusted_config


class ProbeModuleCostAndPriceSessionCostConfigurationAdjustment(EverestConfigAdjustmentStrategy):
"""
Probe module to be able to mock the session cost interface calls
"""
def adjust_everest_configuration(self, everest_config: Dict):
adjusted_config = deepcopy(everest_config)

adjusted_config["active_modules"]["probe"]["connections"]["session_cost"] = [
{"module_id": "ocpp", "implementation_id": "session_cost"}]

return adjusted_config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem to be defined similar for ocpp16 and ocpp201 so I think they can be moved to some common file and the be imported

Comment on lines 239 to 244
# probe_module.implement_command("ProbeModuleDisplayMessage", "set_display_message",
# probe_module_mock_fn)
# probe_module.implement_command("ProbeModuleDisplayMessage", "get_display_messages",
# probe_module_mock_fn)
# probe_module.implement_command("ProbeModuleDisplayMessage", "clear_display_message",
# probe_module_mock_fn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

@maaikez maaikez force-pushed the feature/cost_and_price_display_message_tests branch 2 times, most recently from 5783a7e to 37f21a6 Compare December 10, 2024 15:03
@Pietfried Pietfried force-pushed the feature/cost_and_price_display_message_tests branch from 37f21a6 to 2db9d09 Compare December 13, 2024 14:33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just use the name california_pricing.py for this file since its inside the ocpp16 directory

@maaikez maaikez force-pushed the feature/cost_and_price_display_message_tests branch 2 times, most recently from 37f21a6 to 427dd02 Compare December 16, 2024 09:59
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…icing tests for 1.6 to a new file.

Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…licting test file names)

Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…st file names.

Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
@maaikez maaikez force-pushed the feature/cost_and_price_display_message_tests branch from d9b8c7e to 7508df8 Compare December 16, 2024 12:05
@maaikez maaikez merged commit a9d1ab0 into main Dec 16, 2024
12 checks passed
@maaikez maaikez deleted the feature/cost_and_price_display_message_tests branch December 16, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants