TestCenter Reference
TestSupport.ChangeSet.ChangeSet Class Reference

Class to handle field changes and make them revertable. More...

Inheritance diagram for TestSupport.ChangeSet.ChangeSet:
TestSupport.TestHelper.TC_ChangeSet

Public Member Functions

def __init__ (self, context)
 The default constructor. More...
 
def __del__ (self)
 The default destructor. More...
 
def setFieldValue (self, fieldName, fieldValue, verbose=False)
 Set the value of a field. More...
 
def addField (self, fieldName, verbose=False)
 Add a field and its value without setting it. More...
 
def revert (self)
 Revert all changes made. More...
 
def enableAutoRevert (self, enable)
 

Detailed Description

Class to handle field changes and make them revertable.

The first time a field value is changed the original value is backed up such that it can be restored later on. Restoring will be done at destruction time or using the revert method. It is possible to create a hierarchy of ChangeSets to make interleaved usage possible. It allows to create temporary settings that are reverted to a previous state such that other settings can be used using a basic setting. Each ChangeSet is allowed to have one child only!

Definition at line 26 of file ChangeSet.py.

Constructor & Destructor Documentation

◆ __init__()

def TestSupport.ChangeSet.ChangeSet.__init__ (   self,
  context 
)

◆ __del__()

def TestSupport.ChangeSet.ChangeSet.__del__ (   self)

The default destructor.

This is where the made changes are reverted.

Definition at line 49 of file ChangeSet.py.

References TestSupport.ChangeSet.ChangeSet.__ctx, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__enableAutoRevert, and TestSupport.ChangeSet.ChangeSet.revert().

Member Function Documentation

◆ addField()

def TestSupport.ChangeSet.ChangeSet.addField (   self,
  fieldName,
  verbose = False 
)

Add a field and its value without setting it.

This can be useful for fields that are changed automatically.

Parameters
fieldNameThe name of the field to be added.
verboseBe verbose.
Returns
True if adding field succeeded.

Definition at line 104 of file ChangeSet.py.

References TestSupport.ChangeSet.ChangeSet.__changeDict, TestSupport.ChangeSet.ChangeSet.__ctx, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet._logError(), and TestSupport.ChangeSet.getFieldValue().

◆ enableAutoRevert()

def TestSupport.ChangeSet.ChangeSet.enableAutoRevert (   self,
  enable 
)

Definition at line 125 of file ChangeSet.py.

References TestSupport.ChangeSet.ChangeSet.__enableAutoRevert.

◆ revert()

◆ setFieldValue()

def TestSupport.ChangeSet.ChangeSet.setFieldValue (   self,
  fieldName,
  fieldValue,
  verbose = False 
)

Set the value of a field.

The initial value of the field will be stored such that it can be restored after the required operation have been done.

Parameters
fieldNameThe field to set.
fieldValueThe new value of the given field.
verboseGive information which field was set.
Returns
False if setting field value failed.

Definition at line 72 of file ChangeSet.py.

References TestSupport.ChangeSet.ChangeSet.__changeDict, TestSupport.ChangeSet.ChangeSet.__changeStack, TestSupport.ChangeSet.ChangeSet.__ctx, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet._logError(), TestSupport.ChangeSet.ChangeSet._logInfo(), and TestSupport.ChangeSet.getFieldValue().

Referenced by TestSupport.ChangeSet.ChangeSet.revert().


The documentation for this class was generated from the following file: