How to use _test_services_helper method in tempest

Best Python code snippet using tempest_python

test_decorators.py

Source:test_decorators.py Github

copy

Full Screen

...58 def test_idempotent_id_not_valid_uuid(self):59 _id = '42'60 self.assertRaises(ValueError, self._test_helper, _id)61class TestServicesDecorator(BaseDecoratorsTest):62 def _test_services_helper(self, *decorator_args):63 class TestFoo(test.BaseTestCase):64 @utils.services(*decorator_args)65 def test_bar(self):66 return 067 t = TestFoo('test_bar')68 self.assertEqual(set(decorator_args), getattr(t.test_bar,69 '__testtools_attrs'))70 self.assertEqual(t.test_bar(), 0)71 def test_services_decorator_with_single_service(self):72 self._test_services_helper('compute')73 def test_services_decorator_with_multiple_services(self):74 self._test_services_helper('compute', 'network')75 def test_services_decorator_with_duplicated_service(self):76 self._test_services_helper('compute', 'compute')77 def test_services_decorator_with_invalid_service(self):78 self.assertRaises(exceptions.InvalidServiceTag,79 self._test_services_helper, 'compute',80 'bad_service')81 def test_services_decorator_with_service_valid_and_unavailable(self):82 self.useFixture(fixtures.MockPatchObject(test.CONF.service_available,83 'cinder', False))84 self.assertRaises(testtools.TestCase.skipException,85 self._test_services_helper, 'compute',86 'volume')87 def test_services_list(self):88 service_list = utils.get_service_list()89 for service in service_list:90 try:91 self._test_services_helper(service)92 except exceptions.InvalidServiceTag:93 self.fail('%s is not listed in the valid service tag list'94 % service)95 except KeyError:96 # NOTE(mtreinish): This condition is to test for an entry in97 # the outer decorator list but not in the service_list dict.98 # However, because we're looping over the service_list dict99 # it's unlikely we'll trigger this. So manual review is still100 # need for the list in the outer decorator.101 self.fail('%s is in the list of valid service tags but there '102 'is no corresponding entry in the dict returned from'103 ' get_service_list()' % service)104 except testtools.TestCase.skipException:105 # Test didn't raise an exception because of an incorrect list...

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