TestCenter Reference
|
Class to handle field changes and make them revertable. More...
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 | autoRevert (self) |
Revert all changes made if auto-revert is enabled. More... | |
def | revert (self) |
Revert all changes made. More... | |
def | enableAutoRevert (self, enable) |
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 29 of file ChangeSet.py.
def TestSupport.ChangeSet.ChangeSet.__init__ | ( | self, | |
context | |||
) |
The default constructor.
context | The context to be used. |
Reimplemented in TestSupport.TestHelper.TC_ChangeSet.
Definition at line 42 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.__changeDict, TestSupport.ChangeSet.ChangeSet.__changeStack, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCaseSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCase.__ctx, and TestSupport.ChangeSet.ChangeSet.__enableAutoRevert.
def TestSupport.ChangeSet.ChangeSet.__del__ | ( | self | ) |
The default destructor.
This is where the made changes are reverted if this hasn't happened before
Definition at line 53 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.autoRevert().
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.
fieldName | The name of the field to be added. |
verbose | Be verbose. |
Definition at line 111 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.__changeDict, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCaseSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCase.__ctx, TestSupport.ChangeSet.ChangeSet._logError(), TestSupport.TestHelper.TC_ChangeSet._logError(), and TestSupport.ChangeSet.getFieldValue().
def TestSupport.ChangeSet.ChangeSet.autoRevert | ( | self | ) |
Revert all changes made if auto-revert is enabled.
Definition at line 124 of file ChangeSet.py.
References TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCaseSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCase.__ctx, TestSupport.ChangeSet.ChangeSet.__enableAutoRevert, and TestSupport.ChangeSet.ChangeSet.revert().
Referenced by TestSupport.ChangeSet.ChangeSet.__del__().
def TestSupport.ChangeSet.ChangeSet.enableAutoRevert | ( | self, | |
enable | |||
) |
Definition at line 142 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.__enableAutoRevert.
def TestSupport.ChangeSet.ChangeSet.revert | ( | self | ) |
Revert all changes made.
Definition at line 132 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.__changeDict, TestSupport.ChangeSet.ChangeSet.__changeStack, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCaseSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCase.__ctx, and TestSupport.ChangeSet.ChangeSet.setFieldValue().
Referenced by TestSupport.ChangeSet.ChangeSet.autoRevert().
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.
fieldName | The field to set. |
fieldValue | The new value of the given field. |
verbose | Give information which field was set. |
Definition at line 78 of file ChangeSet.py.
References TestSupport.ChangeSet.ChangeSet.__changeDict, TestSupport.ChangeSet.ChangeSet.__changeStack, TestCenterAdvanced.Slave.Slave.__ctx, TestSupport.ChangeSet.ChangeSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCaseSet.__ctx, TestSupport.FieldValueTests.FieldValueTestCase.__ctx, TestSupport.ChangeSet.ChangeSet._logError(), TestSupport.TestHelper.TC_ChangeSet._logError(), TestSupport.ChangeSet.ChangeSet._logInfo(), TestSupport.TestHelper.TC_ChangeSet._logInfo(), and TestSupport.ChangeSet.getFieldValue().
Referenced by TestSupport.ChangeSet.ChangeSet.revert().