Skip to content

Commit

Permalink
ISSUE-544 cleanup non needed line and add doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
wafa-yah committed Jan 12, 2024
1 parent cb32037 commit 9dee2e3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/test_charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,24 @@ def test_remove_nones_with_list_of_strings():

@pytest.mark.asyncio
async def test_call_unique_id_added_to_handler_args_correctly(connection):
"""
This test ensures that the `call_unique_id` is getting passed to the
`on` and `after` handlers only if it is explicitly set in the handler signature.
To cover all possible cases, we define two chargers:
ChargerA:
`call_unique_id` not required on `on` handler but required on `after` handler.
ChargerB:
`call_unique_id` required on `on` handler but not required on `after` handler.
Each handler verifies a set of asserts to verify that the `call_unique_id`
is passed correctly.
To confirm that the handlers are actually being called and hence the asserts
are being ran, we introduce a set of counters that increase each time a specific
handler runs.
"""
charger_a_test_call_unique_id = "charger_a_1234"
charger_b_test_call_unique_id = "charger_b_5678"
payload_a = {"chargePointVendor": "foo_a", "chargePointModel": "bar_a"}
Expand Down Expand Up @@ -299,8 +317,6 @@ def after_boot_notification(self, *args, **kwargs):
charger_a = ChargerA("charger_a_id", connection)
charger_b = ChargerB("charger_b_id", connection)

create_route_map(charger_a)

msg_a = Call(
unique_id=charger_a_test_call_unique_id,
action=Action.BootNotification.value,
Expand Down

0 comments on commit 9dee2e3

Please sign in to comment.