VirtualBox

Ignore:
Timestamp:
Apr 29, 2020 7:31:28 PM (5 years ago)
Author:
vboxsync
Message:

TestManager/testbox.py: Validation fix for adding testbox with scheduling group memberships. Hidden idTestBox fields didn't validate correctly because they were nil (testbox not existing yet), but hard to tell for invisible fields...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/testbox.py

    r83384 r84091  
    686686        dErrors = {};
    687687
     688        # HACK ALERT! idTestBox might not have been validated and converted yet, but we need detect
     689        #             adding so we can ignore idTestBox being NIL when validating group memberships.
     690        ## @todo make base.py pass us the ksValidateFor_Xxxx value.
     691        fIsAdding = True if self.idTestBox in [ None, -1, '-1', 'None', '' ] else False;
     692
    688693        for iInGrp, oInSchedGroup in enumerate(self.aoInSchedGroups):
    689694            oInSchedGroup = copy.copy(oInSchedGroup);
    690695            oInSchedGroup.idTestBox = self.idTestBox;
    691             dCurErrors = oInSchedGroup.validateAndConvert(oDb, ModelDataBase.ksValidateFor_Other);
     696            if fIsAdding:
     697                dCurErrors = oInSchedGroup.validateAndConvertEx(['idTestBox',] + oInSchedGroup.kasAllowNullAttributes,
     698                                                                oDb, ModelDataBase.ksValidateFor_Add);
     699            else:
     700                dCurErrors = oInSchedGroup.validateAndConvert(oDb, ModelDataBase.ksValidateFor_Other);
    692701            if not dCurErrors:
    693702                pass; ## @todo figure out the ID?
     
    695704                asErrors = [];
    696705                for sKey in dCurErrors:
    697                     asErrors.append('%s: %s' % (sKey[len('TestBoxInSchedGroup_'):], dCurErrors[sKey]));
     706                    asErrors.append('%s: %s' % (sKey[len('TestBoxInSchedGroup_'):], dCurErrors[sKey] + ('{%s}' % self.idTestBox)));
    698707                dErrors[iInGrp] = '<br>\n'.join(asErrors)
    699708            aoNewValues.append(oInSchedGroup);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette