How to use _create_and_check_keypairs method in tempest

Best Python code snippet using tempest_python

test_keypairs_v210.py

Source:test_keypairs_v210.py Github

copy

Full Screen

...22 def setup_clients(cls):23 super(KeyPairsV210TestJSON, cls).setup_clients()24 cls.client = cls.os_adm.keypairs_client25 cls.non_admin_client = cls.os.keypairs_client26 def _create_and_check_keypairs(self, user_id):27 key_list = list()28 for _ in range(2):29 k_name = data_utils.rand_name('keypair')30 keypair = self.create_keypair(k_name,31 keypair_type='ssh',32 user_id=user_id)33 self.assertEqual(k_name, keypair['name'],34 "The created keypair name is not equal "35 "to the requested name!")36 self.assertEqual(user_id, keypair['user_id'],37 "The created keypair is not for requested user!")38 keypair.pop('private_key', None)39 keypair.pop('user_id')40 key_list.append(keypair)41 return key_list42 @decorators.idempotent_id('3c8484af-cfb3-48f6-b8ba-d5d58bbf3eac')43 def test_admin_manage_keypairs_for_other_users(self):44 user_id = self.non_admin_client.user_id45 key_list = self._create_and_check_keypairs(user_id)46 first_keyname = key_list[0]['name']47 keypair_detail = self.client.show_keypair(first_keyname,48 user_id=user_id)['keypair']49 self.assertEqual(first_keyname, keypair_detail['name'])50 self.assertEqual(user_id, keypair_detail['user_id'],51 "The fetched keypair is not for requested user!")52 # Create a admin keypair53 admin_keypair = self.create_keypair(keypair_type='ssh')54 admin_keypair.pop('private_key', None)55 admin_keypair.pop('user_id')56 # Admin fetch keypairs list of non admin user57 keypairs = self.client.list_keypairs(user_id=user_id)['keypairs']58 fetched_list = [keypair['keypair'] for keypair in keypairs]59 # Check admin keypair is not present in non admin user keypairs 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