Best Python code snippet using tempest_python
test_identity_providers.py
Source: test_identity_providers.py
...37 self.idps_client.delete_identity_provider, idp_id)38 return idp39 @decorators.idempotent_id('09450910-b816-4150-8513-a2fd4628a0c3')40 def test_identity_provider_create(self):41 idp_id = data_utils.rand_uuid_hex()42 idp_ref = fixtures.idp_ref()43 idp = self._create_idp(idp_id, idp_ref)44 # The identity provider is disabled by default45 idp_ref['enabled'] = False46 # The remote_ids attribute should be set to an empty list by default47 idp_ref['remote_ids'] = []48 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)49 @decorators.idempotent_id('f430a337-545d-455e-bb6c-cb0fdf4be5c1')50 def test_identity_provider_create_with_enabled_true(self):51 idp_id = data_utils.rand_uuid_hex()52 idp_ref = fixtures.idp_ref(enabled=True)53 idp = self._create_idp(idp_id, idp_ref)54 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)55 @decorators.idempotent_id('238e6163-d600-4f59-9982-c621f057221d')56 def test_identity_provider_create_with_remote_ids(self):57 idp_id = data_utils.rand_uuid_hex()58 remote_ids = [data_utils.rand_uuid_hex(), data_utils.rand_uuid_hex()]59 idp_ref = fixtures.idp_ref(remote_ids=remote_ids)60 idp = self._create_idp(idp_id, idp_ref)61 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)62 @decorators.idempotent_id('8a7817ad-27f8-436b-9cbe-46aa20989beb')63 def test_identity_provider_get(self):64 idp_id = data_utils.rand_uuid_hex()65 idp_create = self._create_idp(idp_id, fixtures.idp_ref())66 idp_get = self.idps_client.show_identity_provider(67 idp_id)['identity_provider']68 self._assert_identity_provider_attributes(idp_get, idp_id, idp_create)69 @decorators.idempotent_id('cbfe5de9-c58a-4810-950c-2acdf985879d')70 def test_identity_provider_list(self):71 idp_ids = []72 for _ in range(3):73 idp_id = data_utils.rand_uuid_hex()74 self._create_idp(idp_id, fixtures.idp_ref())75 idp_ids.append(idp_id)76 idp_list = self.idps_client.list_identity_providers()[77 'identity_providers']78 fetched_ids = [fetched_idp['id'] for fetched_idp in idp_list]79 for idp_id in idp_ids:80 self.assertIn(idp_id, fetched_ids)81 @decorators.idempotent_id('36a0d9f0-9517-4139-85d0-f78d905aece5')82 def test_identity_provider_update(self):83 idp_id = data_utils.rand_uuid_hex()84 idp = self._create_idp(idp_id, fixtures.idp_ref(enabled=True))85 # The identity provider should be enabled86 self.assertTrue(idp['enabled'])87 idp = self.idps_client.update_identity_provider(88 idp_id, enabled=False)['identity_provider']89 # The identity provider should be disabled90 self.assertFalse(idp['enabled'])91 idp_get = self.idps_client.show_identity_provider(92 idp_id)['identity_provider']93 self.assertFalse(idp_get['enabled'])94 def _assert_protocol_attributes(self, protocol, protocol_id,95 mapping_id=None):96 self.assertIn('id', protocol)97 self.assertEqual(protocol_id, protocol['id'])98 self.assertIn('mapping_id', protocol)99 if mapping_id:100 self.assertEqual(mapping_id, protocol['mapping_id'])101 def _create_identity_provider_and_mapping(self):102 # Create an identity provider103 idp_id = data_utils.rand_uuid_hex()104 self._create_idp(idp_id, fixtures.idp_ref(enabled=True))105 # Create a mapping rule106 mapping_id = data_utils.rand_uuid_hex()107 self.mappings_client.create_mapping_rule(108 mapping_id, fixtures.mapping_ref())109 self.addCleanup(self.mappings_client.delete_mapping_rule, mapping_id)110 return idp_id, mapping_id111 def _create_protocol(self, idp_id, protocol_id, mapping_id):112 protocol = self.idps_client.add_protocol_and_mapping(113 idp_id, protocol_id, mapping_id)['protocol']114 self.addCleanup(115 self.idps_client.delete_protocol_and_mapping, idp_id, protocol_id)116 return protocol117 @decorators.idempotent_id('f5bdf482-1ad3-4aad-b52e-8fe7c1361104')118 def test_add_protocol_to_identity_provider(self):119 idp_id, mapping_id = self._create_identity_provider_and_mapping()120 # Now we try to add a protocol to the identity provider121 protocol_id = data_utils.rand_uuid_hex()122 protocol = self._create_protocol(idp_id, protocol_id, mapping_id)123 self._assert_protocol_attributes(protocol, protocol_id, mapping_id)124 @decorators.idempotent_id('613d073b-0db7-41aa-b4df-5a1848cde0b3')125 def test_get_protocol_from_identity_provider(self):126 idp_id, mapping_id = self._create_identity_provider_and_mapping()127 # Add a protocol to the identity provider128 protocol_id = data_utils.rand_uuid_hex()129 self._create_protocol(idp_id, protocol_id, mapping_id)130 # Try to get the protocol131 protocol = self.idps_client.get_protocol_and_mapping(132 idp_id, protocol_id)['protocol']133 self._assert_protocol_attributes(protocol, protocol_id, mapping_id)134 @decorators.idempotent_id('6e6501ac-edae-4dc2-bb68-7a2b58602383')135 def test_list_protocols_from_identity_provider(self):136 idp_id, mapping_id = self._create_identity_provider_and_mapping()137 protocol_ids = []138 for _ in range(3):139 protocol_id = data_utils.rand_uuid_hex()140 self._create_protocol(idp_id, protocol_id, mapping_id)141 protocol_ids.append(protocol_id)142 protocols_list = self.idps_client.list_protocols_and_mappings(idp_id)[143 'protocols']144 fetched_ids = [fetched['id'] for fetched in protocols_list]145 for protocol_id in protocol_ids:146 self.assertIn(protocol_id, fetched_ids)147 @decorators.idempotent_id('680d36df-d6b9-4695-be29-6fc2065c5dde')148 def test_update_mapping_from_identity_provider_protocol(self):149 idp_id, mapping_id = self._create_identity_provider_and_mapping()150 # Add a protocol to the identity provider151 protocol_id = data_utils.rand_uuid_hex()152 protocol = self._create_protocol(idp_id, protocol_id, mapping_id)153 # Create another mapping154 new_mapping_id = data_utils.rand_uuid_hex()155 self.mappings_client.create_mapping_rule(156 new_mapping_id, fixtures.mapping_ref())157 # Update the identity provider protocol158 protocol = self.idps_client.update_protocol_mapping(159 idp_id, protocol_id, new_mapping_id)['protocol']160 self._assert_protocol_attributes(protocol, protocol_id, new_mapping_id)161 @decorators.idempotent_id('04fdf262-af91-4a68-a1cf-794c6d2f2eeb')162 def test_add_protocol_to_identity_provider_unknown_mapping(self):163 # Create an identity provider164 idp_id = data_utils.rand_uuid_hex()165 self._create_idp(idp_id, fixtures.idp_ref(enabled=True))166 # Now we try to add a protocol to the identity provider using167 # a non existent mapping ID168 mapping_id = data_utils.rand_uuid_hex()169 protocol_id = data_utils.rand_uuid_hex()170 self.assertRaises(171 lib_exc.BadRequest,172 self._create_protocol,173 idp_id,174 protocol_id,175 mapping_id)176 @decorators.idempotent_id('c73311e7-c207-4c11-998f-532a91f1b0d1')177 def test_update_protocol_from_identity_provider_unknown_mapping(self):178 idp_id, mapping_id = self._create_identity_provider_and_mapping()179 # Add a protocol to the identity provider180 protocol_id = data_utils.rand_uuid_hex()181 self._create_protocol(idp_id, protocol_id, mapping_id)182 # Update the identity provider protocol using a non existent183 # mapping_id184 new_mapping_id = data_utils.rand_uuid_hex()185 self.assertRaises(186 lib_exc.BadRequest,187 self.idps_client.update_protocol_mapping,188 idp_id,189 protocol_id,...
Check out the latest blogs from LambdaTest on this topic:
These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.
I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.
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!!