How to use _test_requires_ext_helper method in tempest

Best Python code snippet using tempest_python

test_decorators.py

Source:test_decorators.py Github

copy

Full Screen

...109 def setUp(self):110 super(TestRequiresExtDecorator, self).setUp()111 cfg.CONF.set_default('api_extensions', ['enabled_ext', 'another_ext'],112 'compute-feature-enabled')113 def _test_requires_ext_helper(self, expected_to_skip=True,114 **decorator_args):115 class TestFoo(test.BaseTestCase):116 @utils.requires_ext(**decorator_args)117 def test_bar(self):118 return 0119 t = TestFoo('test_bar')120 if expected_to_skip:121 self.assertRaises(testtools.TestCase.skipException, t.test_bar)122 else:123 try:124 self.assertEqual(t.test_bar(), 0)125 except testtools.TestCase.skipException:126 # We caught a skipException but we didn't expect to skip127 # this test so raise a hard test failure instead.128 raise testtools.TestCase.failureException(129 "Not supposed to skip")130 def test_requires_ext_decorator(self):131 self._test_requires_ext_helper(expected_to_skip=False,132 extension='enabled_ext',133 service='compute')134 def test_requires_ext_decorator_disabled_ext(self):135 self._test_requires_ext_helper(extension='disabled_ext',136 service='compute')137 def test_requires_ext_decorator_with_all_ext_enabled(self):138 cfg.CONF.set_default('api_extensions', ['all'],139 group='compute-feature-enabled')140 self._test_requires_ext_helper(expected_to_skip=False,141 extension='random_ext',142 service='compute')143 def test_requires_ext_decorator_bad_service(self):144 self.assertRaises(KeyError,145 self._test_requires_ext_helper,146 extension='enabled_ext',...

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