Patrick Schurig 6c68d17edc test(charging): table des droits NymeaEnergy.* figée, et droits mordant sur transport authentifié
testNymeaEnergyPermissionScopes compare le permissionScope PUBLIÉ par JSONRPC.Introspect (la
table que nymea consulte) à une table écrite dans le test : méthode ajoutée, retirée ou droit
changé → échec, avec tous les écarts listés.

testNymeaEnergyPermissionsEnforced crée de vrais comptes sur le MockTcpServer du harnais, dont
l'authentification est active (Hello : authenticationRequired vérifié) :
- sans droit : GetLoadTelemetry, GetTariff, GetBatteryLevelConsideration répondent ;
  SetTariff {zones: []} et SetLoadDerogation → « Permission denied. », tarif inchangé ;
- ControlThings : SetLoadDerogation posée puis levée ; SetLoadConfig refusé, config inchangée ;
- ConfigureThings : SetTariff passe ; SetPhasePowerLimit et GetOptimizerTrace refusés.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:26:24 +02:00

93 lines
3.2 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright (C) 2013 - 2024, nymea GmbH
* Copyright (C) 2024 - 2025, chargebyte austria GmbH
*
* This file is part of nymea-energy-plugin-nymea.
*
* nymea-energy-plugin-nymea.s free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nymea-energy-plugin-nymea.s distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with nymea-energy-plugin-nymea. If not, see <https://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <QSignalSpy>
#include <QtTest>
#include "../common/energytestbase.h"
class TestCharging: public EnergyTestBase
{
Q_OBJECT
public:
explicit TestCharging(QObject *parent = nullptr);
private slots:
// Basic adding and removing mock things
void testAddCharger();
void testAddSimpleCharger();
void testAddCar();
void testAddMeter();
// Basic api calls
void getSetPhaseLimits();
void getSetLockOnUnplug_data();
void getSetLockOnUnplug();
void getSetAcquisitionTolerance_data();
void getSetAcquisitionTolerance();
void getSetBatteryLevelConsideration_data();
void getSetBatteryLevelConsideration();
void addChargingInfo_data();
void addChargingInfo();
// [ETM] La description publiee de SetChargingInfo est un contrat : le test porte sur le
// COMPORTEMENT qu'elle annonce, pas sur la non-vacuite d'une reponse.
void setChargingInfoReplacesWholesale();
//! GetChargingInfos FILTRE sur evChargerId. Le paramètre était déclaré au schéma, documenté
//! « for all or a single EV charger », et Q_UNUSED : accepté, sans effet, sans erreur.
void getChargingInfosFiltersOnCharger();
//! [ETM] Le droit PUBLIÉ de chaque méthode NymeaEnergy.* (JSONRPC.Introspect) est comparé à une
//! table écrite ici. Une méthode ajoutée, retirée ou dont le droit change le fait échouer.
void testNymeaEnergyPermissionScopes();
//! [ETM] Les droits MORDENT : comptes réels à droits réduits, sur le transport authentifié du
//! harnais. Lire passe sans droit ; écrire est refusé sans changer l'état.
void testNymeaEnergyPermissionsEnforced();
// Test individual logic
void testEcoMode_data();
void testEcoMode();
void testEcoModePhaseSwitching_data();
void testEcoModePhaseSwitching();
void testBatteryLevelConsideration_data();
void testBatteryLevelConsideration();
void batteryLevelConsiderationStopCharging_data();
void batteryLevelConsiderationStopCharging();
void testOverloadProtectionManualMode_data();
void testOverloadProtectionManualMode();
void testOverloadProtectionEcoMode_data();
void testOverloadProtectionEcoMode();
};