async def test_send_call_with_timeout(connection): cs = ChargePoint(id=1234, connection=connection, response_timeout=0.1) payload = call.ResetPayload(type="Hard") with pytest.raises(asyncio.TimeoutError): await cs.call(payload) # Verify that lock is released if call() crahses. Not releasing the lock # in case of an exception could lead to a deadlock. See # https://github.com/mobilityhouse/ocpp/issues/46 assert cs._call_lock.locked() is False
async def reset(self): request = call.ResetPayload( type=ResetType. hard #Required. This contains the type of reset that the Charge Point should perform ) self.export_json_file(request.__dict__, "./dataFromServer2Cp", "Reset.req") response = await self.call(request) self.export_json_file(response.__dict__, "./dataFromServer2Cp", "Reset.con") print("reset response is ", response)
async def test_send_invalid_call(base_central_system): payload = call.ResetPayload(type="Medium") with pytest.raises(ValidationError): await base_central_system.call(payload)
async def send_reset(self, type: ResetType) -> call_result.ResetPayload: return await self.call(call.ResetPayload(type=type))