testframework.clients.ops.tester packageο
This module provides the tester package extension for the ops client.
- class testframework.clients.ops.tester.OpsClient(tb: TestBench, default_timeout: int)ο
Bases:
OpsBaseClient
Ops Client class for testing operations.
Also known as the βNo Brainerβ client
This class inherits from the OpsBaseClient class and provides additional methods that are related to managing the OpsContainer in a test context
If youβre intending to write tests against a testbench with testbrain on it, we recommend using the OpsClientRecorded class, which adds the functionality of annototations in Grafana. usage:
Example
>>> from testframework.clients.ops.tester.tester_client_recorded import OpsClientRecorded
- assert_response_success(response: Response) None ο
Asserts that the response is successful. :param response: The response object to be validated. :type response: requests.Response
- Returns:
If function returns then assertion passes
- Return type:
None
- Raises:
AssertionError β If the response status code is not in the range of 2xx.
- assert_sensor_value_matches(sensor_name: GlobalSensorName, expected: str | int)ο
Check if the sensor value matches the expected value.
- Parameters:
ops_interface (OpsInterface) β The OpsInterface object used to interact with the API.
sensor_name (GlobalSensorName) β The name of the sensor.
expected (str | int) β The expected value of the sensor.
- Raises:
AssertionError β If the sensor value does not match the expected value or if the API call fails.
- check_battery(battery_level_lowerl: float = 30, battery_level_upperl: float = 85)ο
Check if the battery charge level is within the desired limits.
- Parameters:
ops_interface (OpsInterface) β The interface object for interacting with the ops system.
battery_level_lowerl (float, optional) β The lower limit for the battery charge level. Defaults to 30.
battery_level_upperl (float, optional) β The upper limit for the battery charge level. Defaults to 85.
- Raises:
AssertionError β If the validation check for the value fails.
- check_errors()ο
Checks that no error codes are present in the system.
- Parameters:
ops_interface (OpsInterface) β The interface for interacting with the system.
- Raises:
AssertionError β If getting the error state from the API was not successful.
- check_preconditions() None ο
Executes all available precondition checks. - check_properties_inverter - check_properties_battery - check_default_params - check_errors - check_battery :param ops_interface: The interface for interacting with the operations. :type ops_interface: OpsInterface
- Returns:
None
- check_properties_battery()ο
Validate battery properties in testbench with reference value
- check_properties_dongle()ο
Validate dongle properties in testbench with reference value.
- Raises:
AssertionError β If the reference data of the testbench is missing or if the serial number is not matching.
- check_properties_inverter()ο
Checks the properties of the inverter device against the inventory data. If any of the properties do not match the inventory data, an AssertionError is raised.
Args:
- Raises:
AssertionError β If any of the properties do not match the reference data.
- check_value(value: float | int, comp: Comparators, expected: list[float | int], break_on_fail: bool | None = False) float ο
Checks value with given comparator.
- Parameters:
value (float | int) β The value to be checked.
comp (Comparators) β The comparator to be used for comparison.
expected (List[float | int]) β The expected values for comparison.
break_on_fail (Optional[bool]) β If True, the test will stop immediately on failure. If False or None, the test will continue and log the failure at the end. Defaults to None.
- Returns:
The original value.
- Return type:
float
- ensure_default_params() None ο
Check that default parameters are applied from Ops API and apply them if not.
This function sends a POST request to the Ops API to set the default parameters. If the API response is 200, it means that the default parameters were successfully set. If the API response is not 200, it raises an exception.
- Parameters:
ops_interface (OpsInterface) β An instance of the OpsInterface class.
- Raises:
AssertionError β If the API response is not 200.
- get_manufacturer(actual_device_properties: list[DeviceProperties]) str ο
Fetches the manufacturer from the device properties.
- Parameters:
actual_device_properties (list) β A list of device properties.
- Returns:
The manufacturer of the device.
- Return type:
str
- Raises:
AssertionError β If the manufacturer is None.
- run_validation_check(value, comp, expected)ο
Runs a validation check on the given value using the specified comparison operator and expected value.
- Parameters:
value β The value to be validated.
comp β The comparison operator to be used for validation.
expected β The expected value or range of values for comparison.
- Returns:
None
- Raises:
AssertionError β If the validation check fails.
Submodulesο
- testframework.clients.ops.tester.modbus_container module
- testframework.clients.ops.tester.tester_client module
OpsClient
OpsClient.assert_response_success()
OpsClient.assert_sensor_value_matches()
OpsClient.check_battery()
OpsClient.check_errors()
OpsClient.check_preconditions()
OpsClient.check_properties_battery()
OpsClient.check_properties_dongle()
OpsClient.check_properties_inverter()
OpsClient.check_value()
OpsClient.ensure_default_params()
OpsClient.get_manufacturer()
OpsClient.run_validation_check()
- testframework.clients.ops.tester.tester_client_recorded module
- testframework.clients.ops.tester.wallbox module
Phase
RemoteStartStopStatus
ResetTypes
ThreePhaseConnector
ThreePhaseElectricalProperties
Wallbox
Wallbox.get_charge_mode()
Wallbox.get_charge_point_charge_flow_w()
Wallbox.get_charge_point_charge_percentage()
Wallbox.get_charge_point_details()
Wallbox.get_charge_point_phase_details()
Wallbox.get_charge_point_power_offered_w()
Wallbox.get_charge_point_power_requested_w()
Wallbox.get_charge_status()
Wallbox.get_electrical_properties()
Wallbox.is_connected()
Wallbox.set_charge_mode()
Wallbox.set_charge_point_charge_value()
Wallbox.start_charging()
Wallbox.stop_charging()
WallboxChargeMode
WallboxChargeStatus