How to use different_of method in Sure

Best Python code snippet using sure_python

core-tests.py

Source:core-tests.py Github

copy

Full Screen

...25 def testPolUni(self):26 uni = self.tree.polUni()27 uni.Rn.should.equal('uni')28 uni.Dn.should.equal('uni')29 uni._url().should_not.be.different_of(30 url + '/api/mo/' + uni.Dn + '.xml'31 )32 def testFvTenant(self):33 tenant = self.tree.polUni().fvTenant('common')34 tenant.Rn.should.equal('tn-[common]')35 tenant.Dn.should.equal('uni/tn-[common]')36 tenant._url().should_not.be.different_of(37 url + '/api/mo/' + tenant.Dn + '.xml'38 )39 def testFvTenantOptionalArgs(self):40 tenant = self.tree.polUni().fvTenant('common', descr='Common tenant')41 tenant.Dn.should.equal('uni/tn-[common]')42 tenant.descr.should.equal('Common tenant')43 def testFvTenantFromKeywordArguments(self):44 tenant = self.tree.polUni().fvTenant(45 name='common', descr='Common tenant'46 )47 tenant.Dn.should.equal('uni/tn-[common]')48 tenant.descr.should.equal('Common tenant')49 def testUrl(self):50 mos = self.api.mit51 mos._url().should.equal(url + '/api/mo.xml')52 def testUniFromDn(self):53 uni = self.api.mit.FromDn('uni')54 uni.should.be.an(pydme.core.Mo)55 uni.ClassName.should.equal('polUni')56 uni.Dn.should.equal('uni')57 def testTenantFromDn(self):58 tenant = self.api.mit.FromDn('uni/tn-[common]')59 tenant.should.be.an(pydme.core.Mo)60 tenant.ClassName.should.equal('fvTenant')61 tenant.name.should.equal('common')62 tenant.Dn.should.equal('uni/tn-[common]')63 def testEpPFromDn(self):64 epp = self.api.mit.FromDn(65 'uni/epp/fv-[uni/tn-infra/ap-access/epg-default]'66 )67 epp.should.be.an(pydme.core.Mo)68 epp.ClassName.should.equal('fvEpP')69 epp.epgPKey.should.equal('uni/tn-infra/ap-access/epg-default')70 epp.Dn.should.equal('uni/epp/fv-[uni/tn-infra/ap-access/epg-default]')71 def testJson(self):72 uni = self.tree.polUni()73 tenant = uni.fvTenant('mgmt')74 tenant.Json.should_not.be.different_of(textwrap.dedent('''\75 {76 "fvTenant": {77 "attributes": {78 "name": "mgmt"79 }80 }81 }'''))82 uni.Json.should_not.be.different_of(textwrap.dedent('''\83 {84 "polUni": {85 "children": [86 {87 "fvTenant": {88 "attributes": {89 "name": "mgmt"90 }91 }92 }93 ]94 }95 }'''))96 def testJsonSetter(self):97 tenant = self.tree.polUni().fvTenant('common')98 tenant.Json = textwrap.dedent('''\99 {100 "fvTenant": {101 "attributes": {102 "name": "common",103 "descr": "Common tenant for sharing"104 }105 }106 }''')107 tenant.name.should.equal('common')108 tenant.descr.should.equal('Common tenant for sharing')109 def testJsonSetterTree(self):110 tree = textwrap.dedent('''\111 {112 "polUni": {113 "children": [114 {115 "fvTenant": {116 "attributes": {117 "name": "test"118 },119 "children": [120 {121 "fvBD": {122 "attributes": {123 "name": "lab"124 },125 "children": [126 {127 "fvRsCtx": {128 "attributes": {129 "tnFvCtxName": "infra"130 }131 }132 }133 ]134 }135 }136 ]137 }138 }139 ]140 }141 }''')142 uni = self.tree.polUni()143 uni.Json = tree144 uni.Json.should_not.be.different_of(tree)145 def testXml(self):146 uni = self.tree.polUni()147 tenant = uni.fvTenant('mgmt')148 tenant.Xml.should_not.be.different_of('<fvTenant name="mgmt"/>\n')149 uni.Xml.should_not.be.different_of(textwrap.dedent('''\150 <polUni>151 <fvTenant name="mgmt"/>152 </polUni>153 '''))154 def testXmlSetter(self):155 tenant = self.tree.polUni().fvTenant('common')156 tenant.Xml = '<fvTenant name="common" descr="Common tenant"/>'157 tenant.name.should.equal('common')158 tenant.descr.should.equal('Common tenant')159 def testXmlSetterTree(self):160 uni = self.tree.polUni()161 tree = textwrap.dedent('''\162 <polUni>163 <fvTenant name="test">164 <fvBD name="lab">165 <fvRsCtx tnFvCtxName="infra"/>166 </fvBD>167 </fvTenant>168 </polUni>169 ''')170 uni.Xml = tree171 uni.Xml.should_not.be.different_of(tree)172 def testMoWithNoNamingProperties(self):173 uni = self.tree.polUni()174 uni.fvTenant('test').fvBD('lab').fvRsCtx().tnFvCtxName = 'infra'175 uni.Xml.should_not.be.different_of(textwrap.dedent('''\176 <polUni>177 <fvTenant name="test">178 <fvBD name="lab">179 <fvRsCtx tnFvCtxName="infra"/>180 </fvBD>181 </fvTenant>182 </polUni>183 '''))184 def testPropertySetter(self):185 tenant = self.tree.polUni().fvTenant('mgmt')186 tenant.descr.should.be(None)187 tenant.descr = 'Sample description'188 tenant.descr.should.equal('Sample description')189 et = etree.XML(tenant.Xml)190 et.tag.should.equal('fvTenant')191 et.attrib['name'].should.equal('mgmt')192 et.attrib['descr'].should.equal('Sample description')193 def testMoChaining(self):194 uni = self.tree.polUni()195 (uni.fvTenant('test').196 fvCtx('infra').Up().197 fvBD('lab').fvRsCtx(tnFvCtxName='infra').Up(2).198 fvBD('hr').fvRsCtx(tnFvCtxName='infra'))199 uni.Xml.should_not.be.different_of(textwrap.dedent('''\200 <polUni>201 <fvTenant name="test">202 <fvCtx name="infra"/>203 <fvBD name="lab">204 <fvRsCtx tnFvCtxName="infra"/>205 </fvBD>206 <fvBD name="hr">207 <fvRsCtx tnFvCtxName="infra"/>208 </fvBD>209 </fvTenant>210 </polUni>211 '''))212 def testNotEnoughNamingProperties(self):213 uni = self.tree.polUni()...

Full Screen

Full Screen

test_epipearl.py

Source:test_epipearl.py Github

copy

Full Screen

...34 '%s/admin/channel%s/get_params.cgi' % (epiphan_url, channel),35 body="publish_type = 6")36 response = self.c.get_params(37 channel=channel, params={'publish_type': ''})38 response['publish_type'].should_not.be.different_of('6')39 @httpretty.activate40 def test_get_multi_params(self):41 channel = 'm1'42 httpretty.register_uri(43 httpretty.GET,44 '%s/admin/channel%s/get_params.cgi' % (45 epiphan_url, channel),46 body="""\47publish_type = 648videosource = D2P280084.sdi-a:0x0/50x100;D2P280084.sdi-b:50x0/50x10049streamport = 800050product_name = Matterhorn51vendor = Epiphan Systems Inc."""52 )53 response = self.c.get_params(54 channel=channel,55 params={56 'publish_type': '',57 'videosource': '',58 'streamport': '',59 'product_name': '',60 'vendor': ''})61 response['publish_type'].should_not.be.different_of('6')62 response['streamport'].should_not.be.different_of('8000')63 response['product_name'].should_not.be.different_of('Matterhorn')64 response['vendor'].should_not.be.different_of('Epiphan Systems Inc.')65 @httpretty.activate66 def test_set_multi_params(self):67 channel = 'm1'68 httpretty.register_uri(69 httpretty.GET,70 '%s/admin/channel%s/set_params.cgi' % (71 epiphan_url, channel),72 body="", status=201)73 response = self.c.set_params(74 channel=channel,75 params={76 'publish_type': '0',77 'streamport': '8000',78 'product_name': 'Matterhorn',79 'vendor': 'Epiphan Systems Inc.'})80 assert response81 @httpretty.activate82 def test_get_infocfg_ok(self):83 resp_data = resp_datafile('get_infocfg', 'ok', 'html')84 httpretty.register_uri(85 httpretty.GET,86 '%s/admin/infocfg' % epiphan_url,87 body=resp_data, status=200)88 response = self.c.get_infocfg()89 infocfg = {90 'channels': [91 {'id': '1', 'name': 'dce_pr'},92 {'id': '2', 'name': 'dce_live_lowbr'},93 {'id': '3', 'name': 'dce_live'},94 {'id': '4', 'name': 'dce_pn'}95 ],96 'recorders': [97 {'id': '1', 'name': 'dce_prpn'}98 ],99 'sources': [100 {'id': 'D2P280762.hdmi-a', 'name': 'HDMI-A'},101 {'id': 'D2P280762.hdmi-b', 'name': 'HDMI-B'},102 {'id': 'D2P280762.sdi-a', 'name': 'SDI-A'},103 {'id': 'D2P280762.sdi-b', 'name': 'SDI-B'},104 {'id': 'D2P280762.vga-a', 'name': 'VGA-A'},105 {'id': 'D2P280762.vga-b', 'name': 'VGA-B'},106 {'id': 'D2P280762.analog-a', 'name': 'Analog-A Audio'},107 {'id': 'D2P280762.analog-b', 'name': 'Analog-B Audio'},108 {'id': 'D2P280762.hdmi-a-audio', 'name': 'HDMI-A Audio'},109 {'id': 'D2P280762.hdmi-b-audio', 'name': 'HDMI-B Audio'},110 {'id': 'D2P280762.sdi-a-audio', 'name': 'SDI-A Audio'},111 {'id': 'D2P280762.sdi-b-audio', 'name': 'SDI-B Audio'},112 ]113 }114 assert response == infocfg115 @livetest116 def test_actual_set_params(self):117 channel = '1'118 ca_url = os.environ['EPI_URL']119 epi = Epipearl(120 ca_url, os.environ['EPI_USER'], os.environ['EPI_PASSWD'])121 response = epi.set_params(122 channel=channel,123 params={'publish_type': os.environ['EPI_PUBLISH_TYPE']})124 response.should.be.ok125 @livetest126 def test_actual_get_params(self):127 channel = '1'128 ca_url = os.environ['EPI_URL']129 epi = Epipearl(130 ca_url, os.environ['EPI_USER'], os.environ['EPI_PASSWD'])131 response = epi.get_params(132 channel=channel, params={'publish_type': ''})133 response['publish_type'].should_not.be.different_of(134 os.environ['EPI_PUBLISH_TYPE'])135 @livetest136 def test_live_set_channel_layout(self):137 channel_id = '1'138 layout = '{"video":[{"type":"source","position":{"left":"0%","top":"0%","width":"100%","height":"100%","keep_aspect_ratio":true},"settings":{"source":"D2P280762.sdi-b"}}],"audio":[{"type":"source","settings":{"source":"D2P280762.analog-b"}}],"background":"#000000","nosignal":{"id":"default"}}'139 ca_url = os.environ['EPI_URL']140 epi = Epipearl(141 ca_url, os.environ['EPI_USER'], os.environ['EPI_PASSWD'])142 for channel_id in ['1', '2', '3', '4']:143 response = epi.set_channel_layout(144 channel_id=channel_id,145 layout=layout, layout_id='1')146 assert response is not None147 r = json.loads(response)...

Full Screen

Full Screen

test_volume_endpoints.py

Source:test_volume_endpoints.py Github

copy

Full Screen

...19 )20 response = VolumeEndpoint.volumes( self.c )21 len( response ).should.be.equal( 3 )22 response[2].keys().should.contain('name')23 response[2]['name'].should_not.be.different_of('volume-00000002')24 @httpretty.activate25 def test_volume_servers( self ):26 volume_name = 'volume-00000123'27 server_prefix = 'myserver'28 httpretty.register_uri( httpretty.GET,29 '%s/api/volumes/%s/servers.json' % ( rest_service_url, volume_name ),30 body=get_json_server_list_response( size=1, prefix_for_server_name=server_prefix ) )31 response = VolumeEndpoint.servers( self.c, volume_name )32 len( response ).should.be.equal( 1 )33 response[0].keys().should.contain('name')34 response[0]['name'].should_not.be.different_of('%s_0' % server_prefix)35 @httpretty.activate36 def test_volume_snapshot_policies( self ):37 cg_name = 'cg-0000123'38 httpretty.register_uri( httpretty.GET,39 '%s/api/consistency_groups/%s/snapshot_policies.json' % ( rest_service_url, cg_name ),40 body=get_json_snapshot_policies_list_response( 6 ) )41 response = VolumeEndpoint.snapshot_policies( self.c, cg_name )42 len( response ).should.be.equal( 6 )43 response[4].keys().should.contain('display_name')44 response[4]['display_name'].should_not.be.different_of('Hourly Snapshots for a Day')45 @httpretty.activate46 def test_volume_snapshots( self ):47 cg_name = 'cg-00004321'48 httpretty.register_uri( httpretty.GET,49 '%s/api/consistency_groups/%s/snapshots.json' % ( rest_service_url, cg_name ),50 body=get_json_snapshot_list_response( 5 ) )51 response = VolumeEndpoint.snapshots( self.c, cg_name )52 len( response ).should.be.equal( 5 )53 response[2].keys().should.contain('name')...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Sure automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful