Best Python code snippet using tempest_python
test_api_version_utils.py
Source:test_api_version_utils.py
...44 def test_cfg_version_min_greater_than_max(self):45 self.assertRaises(exceptions.InvalidAPIVersionRange,46 self._test_version, '2.2', '2.7', '2.9', '2.7')47class TestSelectRequestMicroversion(base.TestCase):48 def _test_request_version(self, test_min_version,49 cfg_min_version, expected_version):50 selected_version = api_version_utils.select_request_microversion(51 test_min_version, cfg_min_version)52 self.assertEqual(expected_version, selected_version)53 def test_cfg_min_version_greater(self):54 self._test_request_version('2.1', '2.3', expected_version='2.3')55 def test_class_min_version_greater(self):56 self._test_request_version('2.5', '2.3', expected_version='2.5')57 def test_cfg_min_version_none(self):58 self._test_request_version('2.5', None, expected_version='2.5')59 def test_class_min_version_none(self):60 self._test_request_version(None, '2.3', expected_version='2.3')61 def test_both_min_version_none(self):62 self._test_request_version(None, None, expected_version=None)63 def test_both_min_version_equal(self):64 self._test_request_version('2.3', '2.3', expected_version='2.3')65class TestMicroversionHeaderMatches(base.TestCase):66 def test_header_matches(self):67 microversion_header_name = 'x-openstack-xyz-api-version'68 request_microversion = '2.1'69 test_respose = {microversion_header_name: request_microversion}70 api_version_utils.assert_version_header_matches_request(71 microversion_header_name, request_microversion, test_respose)72 def test_header_does_not_match(self):73 microversion_header_name = 'x-openstack-xyz-api-version'74 request_microversion = '2.1'75 test_respose = {microversion_header_name: '2.2'}76 self.assertRaises(77 exceptions.InvalidHTTPResponseHeader,78 api_version_utils.assert_version_header_matches_request,...
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!!