Best Python code snippet using pyatom_python
test_clipsaveasimgbyiconno.py
Source:test_clipsaveasimgbyiconno.py
...21 "sobeyhive-http-token": usertoken,22 "sobeyhive-http-tool": "WEBCM",23 "sobeyhive-http-usercode": usercode}24 25 newdata={"type":"biz_sobey_picture","version":1,"object":self.p.getobjectinfo()['ext']}26 newdata['object']['entity']['isseparation']='true'27 newdata['object']['entity']['storagequota']=028 newdata['object']['entity']['guid']=self.p.get_clip_guid() 29 newdata['object']['entity']['subtype']=3230 newdata['object']['entity']['creator']=newdata['object']['entity']['modifier']31 del newdata['object']['entity']['mosid']32 newdata['object']['entity']['item']['trimout']=4000000033 newdata['object']['entity']['item']['length']=86399960000034 del newdata['object']['entity']['item']['streamflag']35 newdata['object']['entity']['status']=036 body=json.dumps(newdata,ensure_ascii=False,indent=4)37 storage=self.p.getobjectinfo()['ext']['entity']['item']['clipfile'][0]['filename']38 filename=storage.replace('\\','%5C')39 url=information.domain+'/CM/CMAPI/CMApi/api/entity/clip/clipsaveasimgbyiconno?filename='+filename+'&iconno='+str(information.iconno)+'&extendname=bmp&fileformatid=568625'40 41 response = requests.request("post",url,headers=header,data=body,verify=False)42 self.assertCountEqual(response.json()['code'],'0', response.json())43 time=response.elapsed.total_seconds()44 self.assertLessEqual(time,information.time ,time)45 46 def test_savejpg(self):47 usercode=self.p.login()['ext']['usercode']48 usertoken=self.p.login()['ext']['usertoken']49 header={"Content-Type": "application/x-www-form-urlencoded",50 "sobeyhive-http-system": "WEBCM",51 "sobeyhive-http-token": usertoken,52 "sobeyhive-http-tool": "WEBCM",53 "sobeyhive-http-usercode": usercode}54 55 newdata={"type":"biz_sobey_picture","version":1,"object":self.p.getobjectinfo()['ext']}56 newdata['object']['entity']['isseparation']='true'57 newdata['object']['entity']['storagequota']=058 newdata['object']['entity']['guid']=self.p.get_clip_guid() 59 newdata['object']['entity']['subtype']=3260 newdata['object']['entity']['creator']=newdata['object']['entity']['modifier']61 del newdata['object']['entity']['mosid']62 newdata['object']['entity']['item']['trimout']=4000000063 newdata['object']['entity']['item']['length']=86399960000064 del newdata['object']['entity']['item']['streamflag']65 newdata['object']['entity']['status']=066 body=json.dumps(newdata,ensure_ascii=False,indent=4)67 storage=self.p.getobjectinfo()['ext']['entity']['item']['clipfile'][0]['filename']68 filename=storage.replace('\\','%5C')69 url=information.domain+'/CM/CMAPI/CMApi/api/entity/clip/clipsaveasimgbyiconno?filename='+filename+'&iconno='+str(information.iconno)+'&extendname=jpg&fileformatid=568625'70 71 response = requests.request("post",url,headers=header,data=body,verify=False)72 self.assertCountEqual(response.json()['code'],'0', response.json())73 time=response.elapsed.total_seconds()74 self.assertLessEqual(time,information.time ,time)75if __name__ == "__main__":76 #import sys;sys.argv = ['', 'Test.testName']...
GEOM_ObjectInfo.py
Source:GEOM_ObjectInfo.py
1# -*- coding: iso-8859-1 -*-2# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE3#4# This library is free software; you can redistribute it and/or5# modify it under the terms of the GNU Lesser General Public6# License as published by the Free Software Foundation; either7# version 2.1 of the License, or (at your option) any later version.8#9# This library is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU12# Lesser General Public License for more details.13#14# You should have received a copy of the GNU Lesser General Public15# License along with this library; if not, write to the Free Software16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17#18# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com19#20# GEOM GEOM_SWIG : binding of C++ omplementaion with Python21# File : GEOM_ObjectInfo.py22# Author : Michael ZORIN23# Module : GEOM24#25import salome26salome.salome_init()27import GEOM28from salome.geom import geomBuilder29geompy = geomBuilder.New(salome.myStudy)30# Create several objects31obj1 = geompy.MakeVertex(0.,0.,0.)32obj2 = geompy.MakeCircleR(150.)33obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)34obj4 = geompy.MakeCylinderRH(100.,200.)35ShapeListCompound = []36ShapeListCompound.append(obj3)37ShapeListCompound.append(obj4)38obj5 = geompy.MakeCompound(ShapeListCompound)39obj1_entry = geompy.addToStudy(obj1, "Object1")40obj2_entry = geompy.addToStudy(obj2, "Object2")41obj3_entry = geompy.addToStudy(obj3, "Object3")42obj4_entry = geompy.addToStudy(obj4, "Object4")43obj5_entry = geompy.addToStudy(obj5, "Object5")44# Get information about objects45hasInfo = geompy.hasObjectInfo()46print "Check if GEOM module provides information about its objects: ", hasInfo47if hasInfo == True:48 print "Information about first object: ", geompy.getObjectInfo(salome.myStudyId, obj1_entry)49 print "Information about second object: ", geompy.getObjectInfo(salome.myStudyId, obj2_entry)50 print "Information about third object: ", geompy.getObjectInfo(salome.myStudyId, obj3_entry)51 print "Information about fourth object: ", geompy.getObjectInfo(salome.myStudyId, obj4_entry)52 print "Information about fifth object: ", geompy.getObjectInfo(salome.myStudyId, obj5_entry)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!