How to use assertIn method in autotest

Best Python code snippet using autotest_python

testYourChaincode.py

Source:testYourChaincode.py Github

copy

Full Screen

...28 ''' Create_Join_Channel must be run as the first test. Each chaincode test is dependent on this test29 So make sure when adding new tests this is picked up as the first one by py.test30 '''31 output = self.runIt("create", "fabricFeatureChaincodes/create_join_channel.sh")32 self.assertIn('Channel "channel0" is created successfully', output)33 self.assertIn('Channel "channel1" is created successfully', output)34 output = self.runIt("join", "fabricFeatureChaincodes/create_join_channel.sh")35 self.assertIn('PEER0 joined on the channel "channel0" successfully', output)36 self.assertIn('PEER0 joined on the channel "channel1" successfully', output)37 self.assertIn('PEER1 joined on the channel "channel0" successfully', output)38 self.assertIn('PEER1 joined on the channel "channel1" successfully', output)39 self.assertIn('PEER2 joined on the channel "channel0" successfully', output)40 self.assertIn('PEER2 joined on the channel "channel1" successfully', output)41 self.assertIn('PEER3 joined on the channel "channel0" successfully', output)42 self.assertIn('PEER3 joined on the channel "channel1" successfully', output)43 #@unittest.skip("skipping")44 def test_FAB3794_example02_invoke_query_inaloop_onallpeers(self):45 ''' This tests example02 chaincode where transfer values from assets46 "a" and "b" via Invoke and then verify values by Querying on Ledger.47 '''48 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_example02.sh")49 self.assertIn("Chaincode 'myccex020' is installed on PEER0 successfully", output)50 self.assertIn("Chaincode 'myccex020' is installed on PEER1 successfully", output)51 self.assertIn("Chaincode 'myccex020' is installed on PEER2 successfully", output)52 self.assertIn("Chaincode 'myccex020' is installed on PEER3 successfully", output)53 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_example02.sh")54 self.assertIn("Chaincode 'myccex020' Instantiation on PEER2 on 'channel0' is successful", output)55 self.assertIn("Chaincode 'myccex020' Instantiation on PEER2 on 'channel1' is successful", output)56 output = self.runIt("invokeQuery", "fabricFeatureChaincodes/e2e_test_example02.sh")57 self.assertIn('Query on PEER0 on channel0/myccex020 is successful', output)58 countPeer0Ch0 = output.count('Query on PEER0 on channel0/myccex020 is successful')59 self.assertEquals(countPeer0Ch0, 2)60 self.assertIn('Query on PEER1 on channel0/myccex020 is successful', output)61 countPeer1Ch0 = output.count('Query on PEER1 on channel0/myccex020 is successful')62 self.assertEquals(countPeer1Ch0, 2)63 self.assertIn('Query on PEER2 on channel0/myccex020 is successful', output)64 countPeer2Ch0 = output.count('Query on PEER2 on channel0/myccex020 is successful')65 self.assertEquals(countPeer2Ch0, 2)66 self.assertIn('Query on PEER3 on channel0/myccex020 is successful', output)67 countPeer3Ch0 = output.count('Query on PEER3 on channel0/myccex020 is successful')68 self.assertEquals(countPeer3Ch0, 2)69 self.assertIn('Query on PEER0 on channel1/myccex020 is successful', output)70 countPeer0Ch1 = output.count('Query on PEER0 on channel1/myccex020 is successful')71 self.assertEquals(countPeer0Ch1, 2)72 self.assertIn('Query on PEER1 on channel1/myccex020 is successful', output)73 countPeer1Ch1 = output.count('Query on PEER1 on channel1/myccex020 is successful')74 self.assertEquals(countPeer1Ch1, 2)75 self.assertIn('Query on PEER2 on channel1/myccex020 is successful', output)76 countPeer2Ch1 = output.count('Query on PEER2 on channel1/myccex020 is successful')77 self.assertEquals(countPeer2Ch1, 2)78 self.assertIn('Query on PEER3 on channel1/myccex020 is successful', output)79 countPeer3Ch1 = output.count('Query on PEER3 on channel1/myccex020 is successful')80 self.assertEquals(countPeer3Ch1, 2)81 self.assertIn('Invoke transaction on PEER0 on channel0/myccex020 is successful', output)82 self.assertIn('Invoke transaction on PEER1 on channel0/myccex020 is successful', output)83 self.assertIn('Invoke transaction on PEER2 on channel0/myccex020 is successful', output)84 self.assertIn('Invoke transaction on PEER3 on channel0/myccex020 is successful', output)85 self.assertIn('Invoke transaction on PEER0 on channel1/myccex020 is successful', output)86 self.assertIn('Invoke transaction on PEER1 on channel1/myccex020 is successful', output)87 self.assertIn('Invoke transaction on PEER2 on channel1/myccex020 is successful', output)88 self.assertIn('Invoke transaction on PEER3 on channel1/myccex020 is successful', output)89 self.assertIn('End-2-End for chaincode example02 completed successfully', output)90 @unittest.skip("skipping")91 def test_FAB3791_example03_negative_test_disallow_write_attempt_in_query(self):92 ''' Test writing to ledger via query fails as expected93 '''94 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_example03.sh")95 self.assertIn("successfully", output)96 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_example03.sh")97 self.assertIn("successfully", output)98 output = self.runIt("invokeQuery", "fabricFeatureChaincodes/e2e_test_example03.sh")99 self.assertIn('Query result on PEER0 is INVALID', output)100 @unittest.skip("skipping")101 def test_FAB3796_example04_chaincode_to_chaincode_call_on_occurrence_of_an_event(self):102 ''' Test chaincode to chaincode calling when an event is generated.103 '''104 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_example04.sh")105 self.assertIn("successfully", output)106 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_example04.sh")107 self.assertIn("successfully", output)108 output = self.runIt("invokeQuery", "fabricFeatureChaincodes/e2e_test_example04.sh")109 self.assertIn("successfully", output)110 @unittest.skip("skipping")111 def test_FAB3797_example05_chaincode_to_chaincode_call_on_same_and_different_channel(self):112 ''' Test chaincode to chaincode calling, when second chaincode exists113 on a different channel.114 '''115 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_example05.sh")116 self.assertIn("Chaincode 'myccex05' is installed on PEER0 successfully", output)117 self.assertIn("Chaincode 'myccex05' is installed on PEER1 successfully", output)118 self.assertIn("Chaincode 'myccex05' is installed on PEER2 successfully", output)119 self.assertIn("Chaincode 'myccex05' is installed on PEER3 successfully", output)120 self.assertIn("Chaincode 'ex02_b' is installed on PEER0 successfully", output)121 self.assertIn("Chaincode 'ex02_b' is installed on PEER1 successfully", output)122 self.assertIn("Chaincode 'ex02_b' is installed on PEER2 successfully", output)123 self.assertIn("Chaincode 'ex02_b' is installed on PEER3 successfully", output)124 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_example05.sh")125 self.assertIn("successfully", output)126 output = self.runIt("invokeQuery", "fabricFeatureChaincodes/e2e_test_example05.sh")127 self.assertIn("successfully", output)128 @unittest.skip("skipping")129 def test_FAB3792_marbles02_init_query_transfer_marbles(self):130 ''' This test few basic operations from marbles02 chaincode.131 '''132 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_marbles02.sh")133 self.assertIn("successfully", output)134 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_marbles02.sh")135 self.assertIn("successfully", output)136 output = self.runIt("initMarble1", "fabricFeatureChaincodes/e2e_test_marbles02.sh")137 self.assertIn("successful", output)138 output = self.runIt("queryMarble1", "fabricFeatureChaincodes/e2e_test_marbles02.sh")139 self.assertIn("successful", output)140 output = self.runIt("initMarble2", "fabricFeatureChaincodes/e2e_test_marbles02.sh")141 self.assertIn("successful", output)142 output = self.runIt("queryMarble2", "fabricFeatureChaincodes/e2e_test_marbles02.sh")143 self.assertIn("Query marble2 on PEER2 on channel0 on chaincode mymarbles020 is successful", output)144 output = self.runIt("txfrMarble", "fabricFeatureChaincodes/e2e_test_marbles02.sh")145 self.assertIn("Txfr marble1 on PEER2 on channel0 on chaincode mymarbles020 to JERRY is successful", output)146 output = self.runIt("queryAfterTxfrMarble", "fabricFeatureChaincodes/e2e_test_marbles02.sh")147 self.assertIn("Query marble1 on PEER2 on channel0 on chaincode mymarbles020 is successful", output)148 @unittest.skip("skipping")149 def test_FAB3793_chaincodeAPIDriver_exercise_chaincode_api_calls_as_invoke_functions(self):150 ''' Calling functions in shim/chaincode.go.151 '''152 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")153 self.assertIn("successfully", output)154 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")155 self.assertIn("successfully", output)156 output = self.runIt("invoke_getTxTimeStamp", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")157 self.assertIn("successful", output)158 output = self.runIt("invoke_getBinding", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")159 self.assertIn("successful", output)160 output = self.runIt("invoke_getCreator", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")161 self.assertIn("successful", output)162 output = self.runIt("invoke_getSignedProposal", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")163 self.assertIn("successful", output)164 output = self.runIt("invoke_getTransient", "fabricFeatureChaincodes/e2e_test_ccapidriver.sh")165 self.assertIn("successful", output)166 @unittest.skip("skipping")167 def test_FAB3793_chaincodeAPIDriver_2_exercise_chaincode_api_calls_as_direct_calls(self):168 ''' Calling functions in shim/chaincode.go.169 '''170 output = self.runIt("install", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")171 self.assertIn("successfully", output)172 output = self.runIt("instantiate", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")173 self.assertIn("successfully", output)174 output = self.runIt("invoke_getTxTimeStamp", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")175 self.assertIn("successful", output)176 output = self.runIt("invoke_getBinding", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")177 self.assertIn("successful", output)178 output = self.runIt("invoke_getCreator", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")179 self.assertIn("successful", output)180 output = self.runIt("invoke_getSignedProposal", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")181 self.assertIn("successful", output)182 output = self.runIt("invoke_getTransient", "fabricFeatureChaincodes/e2e_test_ccapidriver_two.sh")183 self.assertIn("successful", output)184 @unittest.skip("skipping")185 def test_FABXXXX_Laurie_Chaincode(self):186 ''' Calling functions in shim/chaincode.go.187 '''188 pass189 @unittest.skip("skipping")190 def test_FABXXXX_Alpha_Chaincode(self):191 ''' Calling functions in shim/chaincode.go.192 '''193 pass194 @unittest.skip("skipping")195 def test_FABXXXX_XYZ_Chaincode(self):196 ''' Calling functions in shim/chaincode.go.197 '''...

Full Screen

Full Screen

test_Doption.py

Source:test_Doption.py Github

copy

Full Screen

...36 stderr = self.RunGsUtil(37 ['-D', 'cp', fpath, suri(bucket_uri)], return_stderr=True)38 print 'command line:' + ' '.join(['-D', 'cp', fpath, suri(bucket_uri)])39 if self.test_api == ApiSelector.JSON:40 self.assertIn('media body', stderr)41 self.assertNotIn('a1b2c3d4', stderr)42 self.assertIn('Comparing local vs cloud md5-checksum for', stderr)43 self.assertIn('total_bytes_transferred: %d' % len(file_contents),44 stderr)45 def test_minus_D_perf_trace_cp(self):46 """Test upload and download with a sample perf trace token."""47 file_name = 'bar'48 fpath = self.CreateTempFile(file_name=file_name, contents='foo')49 bucket_uri = self.CreateBucket()50 stderr = self.RunGsUtil(['-D', '--perf-trace-token=123', 'cp', fpath,51 suri(bucket_uri)], return_stderr=True)52 self.assertIn('\'cookie\': \'123\'', stderr)53 stderr2 = self.RunGsUtil(['-D', '--perf-trace-token=123', 'cp',54 suri(bucket_uri, file_name), fpath],55 return_stderr=True)56 self.assertIn('\'cookie\': \'123\'', stderr2)57 def test_minus_D_resumable_upload(self):58 fpath = self.CreateTempFile(contents='a1b2c3d4')59 bucket_uri = self.CreateBucket()60 with SetBotoConfigForTest([('GSUtil', 'resumable_threshold', '4')]):61 stderr = self.RunGsUtil(62 ['-D', 'cp', fpath, suri(bucket_uri)], return_stderr=True)63 self.assertNotIn('a1b2c3d4', stderr)64 self.assertIn('Comparing local vs cloud md5-checksum for', stderr)65 self.assertIn('total_bytes_transferred: 8', stderr)66 def test_minus_D_cat(self):67 """Tests cat command with debug option."""68 key_uri = self.CreateObject(contents='0123456789')69 with SetBotoConfigForTest([('Boto', 'proxy_pass', 'secret')]):70 (stdout, stderr) = self.RunGsUtil(71 ['-D', 'cat', suri(key_uri)], return_stdout=True, return_stderr=True)72 self.assertIn('You are running gsutil with debug output enabled.', stderr)73 self.assertIn("reply: 'HTTP/1.1 200 OK", stderr)74 self.assertIn('config:', stderr)75 self.assertIn("('proxy_pass', 'REDACTED')", stderr)76 self.assertIn("reply: 'HTTP/1.1 200 OK", stderr)77 self.assertIn('header: Expires: ', stderr)78 self.assertIn('header: Date: ', stderr)79 self.assertIn('header: Content-Type: application/octet-stream', stderr)80 self.assertIn('header: Content-Length: 10', stderr)81 if self.test_api == ApiSelector.XML:82 self.assertRegexpMatches(83 stderr, '.*HEAD /%s/%s.*Content-Length: 0.*User-Agent: .*gsutil/%s' %84 (key_uri.bucket_name, key_uri.object_name, gslib.VERSION))85 self.assertIn('header: Cache-Control: private, max-age=0',86 stderr)87 self.assertIn('header: Last-Modified: ', stderr)88 self.assertIn('header: ETag: "781e5e245d69b566979b86e28d23f2c7"', stderr)89 self.assertIn('header: x-goog-generation: ', stderr)90 self.assertIn('header: x-goog-metageneration: 1', stderr)91 self.assertIn('header: x-goog-hash: crc32c=KAwGng==', stderr)92 self.assertIn('header: x-goog-hash: md5=eB5eJF1ptWaXm4bijSPyxw==', stderr)93 elif self.test_api == ApiSelector.JSON:94 self.assertRegexpMatches(95 stderr, '.*GET.*b/%s/o/%s.*user-agent:.*gsutil/%s.Python/%s' %96 (key_uri.bucket_name, key_uri.object_name, gslib.VERSION,97 platform.python_version()))98 self.assertIn(('header: Cache-Control: no-cache, no-store, max-age=0, '99 'must-revalidate'), stderr)100 self.assertIn("md5Hash: u'eB5eJF1ptWaXm4bijSPyxw=='", stderr)101 if gslib.IS_PACKAGE_INSTALL:102 self.assertIn('PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMS', stdout)103 else:104 self.assertRegexpMatches(stdout, r'.*checksum: [0-9a-f]{32}.*')105 self.assertIn('gsutil version: %s' % gslib.VERSION, stdout)106 self.assertIn('boto version: ', stdout)107 self.assertIn('python version: ', stdout)108 self.assertIn('OS: ', stdout)109 self.assertIn('multiprocessing available: ', stdout)110 self.assertIn('using cloud sdk: ', stdout)111 self.assertIn('config path: ', stdout)112 self.assertIn('gsutil path: ', stdout)113 self.assertIn('compiled crcmod: ', stdout)114 self.assertIn('installed via package manager: ', stdout)...

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 autotest 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