cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncTest Manager WUI - Test Cases.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCopyright (C) 2012-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiRawHtml;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.core.db import isDbTimestampInfinity;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.core.testcase import TestCaseDataEx, TestCaseData, TestCaseDependencyLogic;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.core.globalresource import GlobalResourceData, GlobalResourceLogic;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WUI test case list content generator.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sTitle = 'Test Cases', fnDPrint = fnDPrint, oDisp = oDisp);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync 'Name', 'Active', 'Default Timeout', 'Base Command / Variations', 'Validation Kit Files',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Base command and variations.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml = ' <table class="tminnertbl" width=100%>\n' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ' <tr>\n' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml += 'Timeout</th><th>Additional Arguments</b></th>\n' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync % ( utils.formatIntervalSeconds(oTmp.cSecTimeout) if oTmp.cSecTimeout is not None else 'Default',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync webutils.escapeElem(oTmp.sArgs.replace('-', u'\u2011')),)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoRet.append([oEntry.sBaseCmd.replace('-', u'\u2011'), WuiRawHtml(sHtml)]);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoRet += [ oEntry.sValidationKitZips if oEntry.sValidationKitZips is not None else '', ];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Show dependency on other testcases
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WuiAdmin.ksParamAction, WuiAdmin.ksActionTestCaseEdit,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Show dependency on global resources
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml += ' <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WuiAdmin.ksParamAction, WuiAdmin.ksActionGlobalRsrcShowEdit,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync GlobalResourceData.ksParam_idGlobalRsrc, sTmp.idGlobalRsrc,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Show actions that can be taken.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }), ];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync TestCaseData.ksParam_idTestCase: oEntry.idTestCase }));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseClone,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDoRemove,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync TestCaseData.ksParam_idTestCase: oEntry.idTestCase },
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sConfirm = 'Are you sure you want to remove test case #%d?' % (oEntry.idTestCase,)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WUI user account content generator.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sTitle = 'Edit Test Case - %s (#%s)' % (oData.sName, oData.idTestCase);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sTitle = 'Test Case - %s (#%s)' % (oData.sName, oData.idTestCase);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WuiFormContentBase.__init__(self, oData, sMode, 'TestCase', oDisp, sTitle);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Read additional bits form the DB.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oDepLogic = TestCaseDependencyLogic(oDisp.getDb());
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self._aoAllTestCases = oDepLogic.getApplicableDepTestCaseData(-1 if oData.idTestCase is None else oData.idTestCase);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self._aoAllGlobalRsrcs = GlobalResourceLogic(oDisp.getDb()).getAll();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addIntRO (TestCaseData.ksParam_idTestCase, oData.idTestCase, 'Test Case ID')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addTimestampRO(TestCaseData.ksParam_tsEffective, oData.tsEffective, 'Last changed')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addTimestampRO(TestCaseData.ksParam_tsExpire, oData.tsExpire, 'Expires (excl)')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addIntRO (TestCaseData.ksParam_uidAuthor, oData.uidAuthor, 'Changed by UID')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addIntRO (TestCaseData.ksParam_idGenTestCase, oData.idGenTestCase, 'Test Case generation ID')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addText (TestCaseData.ksParam_sName, oData.sName, 'Name')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addText (TestCaseData.ksParam_sDescription, oData.sDescription, 'Description')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addCheckBox (TestCaseData.ksParam_fEnabled, oData.fEnabled, 'Enabled')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync utils.formatIntervalSeconds2(oData.cSecTimeout), 'Default timeout')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addWideText (TestCaseData.ksParam_sTestBoxReqExpr, oData.sTestBoxReqExpr, 'TestBox requirements (python)');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addWideText (TestCaseData.ksParam_sBuildReqExpr, oData.sBuildReqExpr, 'Build requirement (python)');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addWideText (TestCaseData.ksParam_sBaseCmd, oData.sBaseCmd, 'Base command')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addText (TestCaseData.ksParam_sValidationKitZips, oData.sValidationKitZips, 'Test suite files')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addListOfTestCaseArgs(TestCaseDataEx.ksParam_aoTestCaseArgs, oData.aoTestCaseArgs, 'Argument variations')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoTestCaseDeps.append([oTestCase.idTestCase, fSelected, oTestCase.sName]);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addListOfTestCases(TestCaseDataEx.ksParam_aoDepTestCases, aoTestCaseDeps, 'Depends on test cases')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync aoGlobalResrcDeps.append([oGlobalRsrc.idGlobalRsrc, fSelected, oGlobalRsrc.sName]);