Skip to content

Commit

Permalink
handling CALLERROR in validation function (#147)
Browse files Browse the repository at this point in the history
Signed-off-by: pietfried <[email protected]>
  • Loading branch information
Pietfried authored Jun 11, 2024
1 parent 7a5196f commit d144f55
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ async def wait_for_and_validate(meta_data: TestUtility, charge_point: CP, exp_ac
raw_message = await asyncio.wait_for(charge_point.wait_for_message(), timeout=timeout)
charge_point.message_event.clear()
msg = unpack(raw_message)
if (msg.action != None):
if (msg.message_type_id == 4):
logging.debug("Received CallError")
elif (msg.action != None):
logging.debug(f"Received Call {msg.action}")
elif (msg.message_type_id == 3):
logging.debug("Received CallResult")
Expand All @@ -131,9 +133,10 @@ async def wait_for_and_validate(meta_data: TestUtility, charge_point: CP, exp_ac
else:
return True
else:
logging.debug(
f"This message {msg.action} with payload {msg.payload} was not what I waited for")
logging.debug(f"I wait for {exp_payload}")
if (msg.message_type_id != 4):
logging.debug(
f"This message {msg.action} with payload {msg.payload} was not what I waited for")
logging.debug(f"I wait for {exp_payload}")
# add msg to messages and wait for next message
meta_data.messages.append(msg)
except asyncio.TimeoutError:
Expand Down Expand Up @@ -174,6 +177,9 @@ def contains_expected_response(expected: dict, msg_payload: dict):

def validate_message(msg, exp_action, exp_payload, validate_payload_func, meta_data):

if (msg.message_type_id == 4):
return False

if msg.action in meta_data.forbidden_actions:
logging.error(
f"Forbidden action {msg.action} was sent by the charge point")
Expand Down

0 comments on commit d144f55

Please sign in to comment.