Exemple #1
0
 def getsubmition_jenkinsjobs(testsubmitionid, jenkinsserverid):
     if jenkinsserverid:
         jenkinsserver = DAL_DictValue.getdatavaluebyid(jenkinsserverid)
         servername = jenkinsserver.DicDataName
         jsonjobs = JenkinsService.getjenkinsjobs(servername)
     else:
         jenkinsservers = DAL_DictValue.getdatavaluebytype("JenkinsServer")
         servername = jenkinsservers[0].DicDataName
         jsonjobs = JenkinsService.getjenkinsjobs(servername)
     result = list()
     for job in jsonjobs['jobs']:
         temp = dict()
         temp["text"] = job['name']
         temp["memberid"] = job['url']
         if testsubmitionid != 0:
             testsubmition = DAL_TestSubmition.gettestsubmition(
                 testsubmitionid)
             if testsubmition.TPSJenkinsJobName == job['url']:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
Exemple #2
0
 def getjenkinsjobs(serverid):
     servername = ""
     if serverid:
         jenkinsserver = DAL_DictValue.getdatavaluebyid(serverid)
         servername = jenkinsserver.DicDataName
         jsonjobs = JenkinsService.getjenkinsjobs(servername)
     else:
         jenkinsservers = DAL_DictValue.getdatavaluebytype("JenkinsServer")
         servername = jenkinsservers[0].DicDataName
         jsonjobs = JenkinsService.getjenkinsjobs(servername)
     return [(job['url'], job['name']) for job in jsonjobs['jobs']]
Exemple #3
0
 def get_scminfo(productnameid, user_dicdataname, password_dicdataname,
                 coderoot_dicdataname):
     scm_user = str(
         DAL_DictValue.getdatavaluebydataname("SCMInfo",
                                              user_dicdataname).DicDataDesc)
     scm_password = str(
         DAL_DictValue.getdatavaluebydataname(
             "SCMInfo", password_dicdataname).DicDataDesc)
     scm_desc = str(DAL_TestProject.get_testproject(productnameid).TPKEY)
     scm_coderoot = str(
         DAL_DictValue.getdatavaluebydataname(
             "SCMInfo", coderoot_dicdataname).DicDataDesc)
     scm_info = SCMInfo(scm_user, scm_password,
                        scm_coderoot + CommonHelper.get_slash() + scm_desc)
     return scm_info
Exemple #4
0
 def getplatform(self):
     platform = "--"
     platformobject = DAL_DictValue.getdatavaluebyid(
         self.testsubmition.TPSPlatform)
     if platformobject:
         platform = platformobject.DicDataName
     return platform
Exemple #5
0
 def getstatus(self):
     status = "--"
     statusobject = DAL_DictValue.getdatavaluebyid(
         self.testsubmition.TPSStatus)
     if statusobject:
         status = statusobject.DicDataName
     return status
Exemple #6
0
 def getproducttype(self):
     producttype = "--"
     producttypeobject = DAL_DictValue.getdatavaluebyid(
         self.testsubmition.TPSProductType)
     if producttypeobject:
         producttype = producttypeobject.DicDataName
     return producttype
 def getqaemaillist(producttypeid, outputemaillist):
     qagroup = DAL_DictValue.getdatavaluebyid(producttypeid).DicDataDesc
     emaillist = outputemaillist
     for user in UserService.getusersbygroup(qagroup):
         if user.email in emaillist:
             pass
         else:
             emaillist.append(user.email)
     return emaillist
    def get_browsers(self):
        browsers = "--"
        if self.autoagent.AAgentBrowser != "":
            browsers = ""
            browsers_list = eval(self.autoagent.AAgentBrowser)
            print(browsers_list)
            for browserid in browsers_list:
                browsers = browsers + DAL_DictValue.get_dataname_by_datavalue(
                    "AutoTaskRuntime", browserid).DicDataName + " "
#             browsers=browsers[0,len(browsers)]
        return browsers
 def getdefaultemailreciverlist(producttypeid,outputemaillist):
     qagroup = DAL_DictValue.getdatavaluebyid(producttypeid).DicDataDesc
     emaillist = outputemaillist
     if qagroup!="DevTest":
         emailconfig = TestJobService.getemaliconfig()
         emailstring = emailconfig['defautrecivers']
         for email in emailstring.split(','):
             if email in emaillist:
                 pass
             else:
                 emaillist.append(email)
     return emaillist
Exemple #10
0
 def trigerjenkinsjob(submitionid):
     try:
         testSubmition = DAL_TestSubmition.gettestsubmition(submitionid)
         jenkinsserver = DAL_DictValue.getdatavaluebyid(
             testSubmition.TPSJenkinsServer).DicDataName
         joburl = testSubmition.TPSJenkinsJobName.replace(
             "http://" + jenkinsserver, '')
         joburl = joburl.replace("job", 'mpttrigger')
         urllist = joburl.split('/')
         newurl = "/" + urllist[1] + "/" + urllist[
             2] + "/build?mptjob=" + urllist[3] + "&mptid=" + str(
                 submitionid) + "&" + testSubmition.TPSBuildParameters
         JenkinsService.trigerbuild(jenkinsserver, str(newurl).strip())
     except Exception as ex:
         pass
 def get_autotask_types(autotaskid):
     tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType")
     result=list()
     for tasktype in tasktypes:
         temp=dict()
         temp["text"]=tasktype.DicDataName
         temp["memberid"]=tasktype.DicDataValue
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if tasktype.DicDataValue==autotask.TaskTpye:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #12
0
 def get_testjob_jobtypes(testjobid):
     avaliblejobtypes = DAL_DictValue.getdatavaluebytype("JobType")
     result=list()
     for dicdata in avaliblejobtypes:
         temp=dict()
         temp["text"]=dicdata.DicDataName
         temp["memberid"]=dicdata.id
         if testjobid!=0:
             testsubmition=DAL_TestJob.gettestjob(testjobid)
             if testsubmition.TJJobType==dicdata.id:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #13
0
 def get_testjob_status(testjobid):
     allstatus = DAL_DictValue.getdatavaluebytype("JobStatus").filter(DicDataDesc=1)
     result=list()
     for status in allstatus:
         temp=dict()
         temp["text"]=status.DicDataName
         temp["memberid"]=status.id
         if testjobid!=0:
             testjob=DAL_TestJob.gettestjob(testjobid)
             if status.id==testjob.TJStatus:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #14
0
 def get_autoagent_os(autoagentid):
     all_os = DAL_DictValue.getdatavaluebytype("AgentOSType")
     result = list()
     if autoagentid != 0:
         autoagent = DAL_AutoAgent.get_autoagent(autoagentid)
     for os in all_os:
         temp = dict()
         temp["text"] = os.DicDataName
         temp["memberid"] = os.DicDataValue
         if autoagentid != 0:
             if os.DicDataValue == autoagent.AOS:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
Exemple #15
0
 def get_testsubmition_projecttype(testsubmitionid):
     avalibleprojecttypes = DAL_DictValue.getdatavaluebytype("ProjectType")
     result = list()
     for dicdata in avalibleprojecttypes:
         temp = dict()
         temp["text"] = dicdata.DicDataName
         temp["memberid"] = dicdata.id
         if testsubmitionid != 0:
             testsubmition = DAL_TestSubmition.gettestsubmition(
                 testsubmitionid)
             if testsubmition.TPSProductType == dicdata.id:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
 def get_autotestconfig_types(autotestconfigid):
     tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType")
     result = list()
     for tasktype in tasktypes:
         temp = dict()
         temp["text"] = tasktype.DicDataName
         temp["memberid"] = tasktype.DicDataValue
         if autotestconfigid != 0:
             autotestconfig = DAL_AutoTestConfig.get_autotest_config(
                 autotestconfigid)
             if tasktype.DicDataValue == autotestconfig.TCFTaskTpye:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
Exemple #17
0
 def get_testsubmition_platforms(testsubmitionid):
     allplatforms = DAL_DictValue.getdatavaluebytype("TestPlatform")
     result = list()
     for dicdata in allplatforms:
         temp = dict()
         temp["text"] = dicdata.DicDataName
         temp["memberid"] = dicdata.id
         if testsubmitionid != 0:
             testsubmition = DAL_TestSubmition.gettestsubmition(
                 testsubmitionid)
             if testsubmition.TPSPlatform == dicdata.id:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
Exemple #18
0
 def get_autorunresult_browsers(autorunresultid):
     all_browsers=DAL_DictValue.getdatavaluebytype("AutoTaskRuntime").filter(DicDataDesc='WEB')
     result=list()
     if autorunresultid!=0:
         autorunresult=DAL_AutoRunResult.get_autorunresult(autorunresultid)
     for browser in all_browsers:
         temp=dict()
         temp["text"]=browser.DicDataName
         temp["memberid"]=browser.DicDataValue
         if autorunresultid!=0:
             if browser.DicDataValue in eval(autorunresult.AAgentBrowser):
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
 def get_autotestconfig_driver(autotestconfigid):
     alldrivers = DAL_DictValue.getdatavaluebytype("AutoAgentExecDriver")
     result = list()
     for driver in alldrivers:
         temp = dict()
         temp["text"] = driver.DicDataName
         temp["memberid"] = driver.id
         if autotestconfigid != 0:
             autotestconfig = DAL_AutoTestConfig.get_autotest_config(
                 autotestconfigid)
             if driver.DicDataValue == autotestconfig.TCFExecuteDriver:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
Exemple #20
0
 def getsubmition_jenkinsserver(testsubmitionid):
     alljenkinsservers = DAL_DictValue.getdatavaluebytype("JenkinsServer")
     result = list()
     for dicdata in alljenkinsservers:
         temp = dict()
         temp["text"] = dicdata.DicDataName
         temp["memberid"] = dicdata.id
         if testsubmitionid != 0:
             testsubmition = DAL_TestSubmition.gettestsubmition(
                 testsubmitionid)
             if testsubmition.TPSJenkinsServer == dicdata.id:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
    def get_autotestconfig_testingenv(autotestconfigid):
        all_testenvs = DAL_DictValue.getdatavaluebytype("TestEnv")
        result = list()
        for env in all_testenvs:
            temp = dict()
            temp["text"] = env.DicDataName
            temp["memberid"] = env.id
            if autotestconfigid != 0:
                autotestconfig = DAL_AutoTestConfig.get_autotest_config(
                    autotestconfigid)

                if autotestconfig.TCFTestingEnv and env.DicDataValue == int(
                        autotestconfig.TCFTestingEnv):
                    temp["selected"] = 1
                else:
                    temp["selected"] = 0
            else:
                temp["selected"] = 0
            result.append(temp)
        return str(result).replace("u'", "'")
 def get_autotestconfig_browsers(autotestconfigid):
     all_browsers = DAL_DictValue.getdatavaluebytype(
         "AutoTaskRuntime").filter(DicDataDesc='WEB')
     result = list()
     if autotestconfigid != 0:
         autotestconfig = DAL_AutoTestConfig.get_autotest_config(
             autotestconfigid)
     for browser in all_browsers:
         temp = dict()
         temp["text"] = browser.DicDataName
         temp["memberid"] = browser.DicDataValue
         if autotestconfigid != 0 and autotestconfig.TCFBrowser:
             if browser.DicDataValue in eval(autotestconfig.TCFBrowser):
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
 def get_autotestconfig_os(autotestconfigid):
     all_os = DAL_DictValue.getdatavaluebytype("AutoTaskRuntime").filter(
         DicDataDesc='APP')
     result = list()
     if autotestconfigid != 0:
         autotestconfig = DAL_AutoTestConfig.get_autotest_config(
             autotestconfigid)
     for os in all_os:
         temp = dict()
         temp["text"] = os.DicDataName
         temp["memberid"] = os.DicDataValue
         print(temp)
         if autotestconfigid != 0:
             if os.DicDataValue == autotestconfig.TCFOS:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
 def get_autotestconfig_osversion(autotestconfigid, osid):
     osname = DAL_DictValue.get_dataname_by_datavalue(
         "AutoTaskRuntime", osid).DicDataName
     if osname == "Android":
         mobiledevice = DAL_AutoMobileDevice.get_device_byos("android")
     else:
         mobiledevice = DAL_AutoMobileDevice.get_device_byos("ios")
     result = list()
     for device in mobiledevice:
         temp = dict()
         temp["text"] = device.MDOSVersion
         temp["value"] = device.MDOSVersion
         if autotestconfigid != 0:
             autotestconfig = DAL_AutoTestConfig.get_autotest_config(
                 autotestconfigid)
             if device.MDOSVersion == autotestconfig.TCFOSVersion:
                 temp["selected"] = 1
             else:
                 temp["selected"] = 0
         else:
             temp["selected"] = 0
         result.append(temp)
     return str(result).replace("u'", "'")
 def getdicvaluebyid(id):
     dicdata = DAL_DictValue.getdatavaluebyid(id)
     if dicdata:
         return dicdata.DicDataName
     else:
         return "--"
Exemple #26
0
 def get_status(self):
     return DAL_DictValue.get_dataname_by_datavalue(
         "AutoAgentStatus", self.autoagent.AStatus).DicDataName
Exemple #27
0
 def get_os(self):
     agent_os = "--"
     if self.autoagent.AOS != 0:
         agent_os = DAL_DictValue.get_dataname_by_datavalue(
             "AgentOSType", self.autoagent.AOS).DicDataName
     return agent_os
Exemple #28
0
 def get_job_types():
     avalibleprojecttypes = DAL_DictValue.getdatavaluebytype("JobType")
     return [(project.id, project.DicDataName) for project in avalibleprojecttypes]
Exemple #29
0
    def get_jobs_status():
        allstatus = DAL_DictValue.getdatavaluebytype("JobStatus").filter(DicDataDesc=1)
#         allstatus=[(48,'暂停'),(50,'未来任务'),(51,'排队中')]
        return [(status.id, status.DicDataName) for status in allstatus]
Exemple #30
0
 def getemaliconfig():
     result = {}
     allconfigs = DAL_DictValue.getdatavaluebytype("EmailConfig")
     for config in allconfigs:
         result[config.DicDataDesc] = config.DicDataName
     return result