How to use _assert_mutual_exclusive_message method in tempest

Best Python code snippet using tempest_python

test_subunit_describe_calls.py

Source:test_subunit_describe_calls.py Github

copy

Full Screen

...141 self.assertIn('- 200 GET request for Nova to v2.1/<id>/',142 data)143 self.assertIn('- 404 DELETE request for Nova to v2.1/<id>/',144 data)145 def _assert_mutual_exclusive_message(self, stderr):146 self.assertIn(b"usage: subunit-describe-calls "147 b"[-h] [-s [<subunit file>]]", stderr)148 self.assertIn(b"[-n <non subunit name>] [-o <output file>]",149 stderr)150 self.assertIn(b"[-p <ports file>] [-v | -a]", stderr)151 self.assertIn(152 b"subunit-describe-calls: error: argument -v/--verbose: "153 b"not allowed with argument -a/--all-stdout", stderr)154 def _assert_no_headers_and_bodies(self, data):155 data = self._bytes_to_string(data)156 self.assertNotIn('- request headers:', data)157 self.assertNotIn('- request body:', data)158 self.assertNotIn('- response headers:', data)159 self.assertNotIn('- response body:', data)160class TestMainCli(TestCliBase):161 """Test cases that use subunit_describe_calls module main interface162 via subprocess calls to make sure the total user experience163 is well defined and tested. This interface is deprecated.164 Note: these test do not affect code coverage percentages.165 """166 def test_main_output_file(self):167 temp_file = tempfile.mkstemp()[1]168 p = subprocess.Popen([169 'subunit-describe-calls', '-s', self._subunit_file,170 '-o', temp_file], stdin=subprocess.PIPE,171 stdout=subprocess.PIPE, stderr=subprocess.PIPE)172 stdout, stderr = p.communicate()173 self.assertEqual(0, p.returncode)174 self._assert_cli_message(stdout)175 self._assert_deprecated_warning(stdout)176 with open(temp_file, 'r') as file:177 data = json.loads(file.read())178 self._assert_expect_json(data)179 def test_main_verbose(self):180 p = subprocess.Popen([181 'subunit-describe-calls', '-s', self._subunit_file,182 '-v'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,183 stderr=subprocess.PIPE)184 stdout, stderr = p.communicate()185 self.assertEqual(0, p.returncode)186 self._assert_cli_message(stdout)187 self._assert_deprecated_warning(stdout)188 self._assert_methods_details(stdout)189 self._assert_headers_and_bodies(stdout)190 def test_main_all_stdout(self):191 p = subprocess.Popen([192 'subunit-describe-calls', '-s', self._subunit_file,193 '--all-stdout'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,194 stderr=subprocess.PIPE)195 stdout, stderr = p.communicate()196 self.assertEqual(0, p.returncode)197 self._assert_cli_message(stdout)198 self._assert_deprecated_warning(stdout)199 self._assert_methods_details(stdout)200 self._assert_headers_and_bodies(stdout)201 def test_main(self):202 p = subprocess.Popen([203 'subunit-describe-calls', '-s', self._subunit_file],204 stdin=subprocess.PIPE, stdout=subprocess.PIPE,205 stderr=subprocess.PIPE)206 stdout, stderr = p.communicate()207 self.assertEqual(0, p.returncode)208 self._assert_cli_message(stdout)209 self._assert_deprecated_warning(stdout)210 self._assert_methods_details(stdout)211 self._assert_no_headers_and_bodies(stdout)212 def test_main_verbose_and_all_stdout(self):213 p = subprocess.Popen([214 'subunit-describe-calls', '-s', self._subunit_file,215 '-a', '-v'],216 stdin=subprocess.PIPE, stdout=subprocess.PIPE,217 stderr=subprocess.PIPE)218 stdout, stderr = p.communicate()219 self.assertEqual(2, p.returncode)220 self._assert_cli_message(stdout)221 self._assert_deprecated_warning(stdout)222 self._assert_mutual_exclusive_message(stderr)223class TestCli(TestCliBase):224 """Test cases that use tempest subunit_describe_calls cliff interface225 via subprocess calls to make sure the total user experience226 is well defined and tested.227 Note: these test do not affect code coverage percentages.228 """229 def _assert_cliff_verbose(self, stdout):230 self.assertIn(b'tempest initialize_app', stdout)231 self.assertIn(b'prepare_to_run_command TempestSubunitDescribeCalls',232 stdout)233 self.assertIn(b'tempest clean_up TempestSubunitDescribeCalls',234 stdout)235 def test_run_all_stdout(self):236 p = subprocess.Popen(['tempest', 'subunit-describe-calls',...

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