def test_identity_provider_create_with_remote_ids(self): idp_id = data_utils.rand_uuid_hex() remote_ids = [data_utils.rand_uuid_hex(), data_utils.rand_uuid_hex()] idp_ref = fixtures.idp_ref(remote_ids=remote_ids) idp = self._create_idp(idp_id, idp_ref) self._assert_identity_provider_attributes(idp, idp_id, idp_ref)
def test_identity_provider_get(self): idp_id = data_utils.rand_uuid_hex() idp_create = self._create_idp(idp_id, fixtures.idp_ref()) idp_get = self.idps_client.show_identity_provider( idp_id)['identity_provider'] self._assert_identity_provider_attributes(idp_get, idp_id, idp_create)
def test_add_protocol_to_identity_provider_unknown_mapping(self): # Create an identity provider idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref(enabled=True)) # Now we try to add a protocol to the identity provider using # a non existent mapping ID mapping_id = data_utils.rand_uuid_hex() protocol_id = data_utils.rand_uuid_hex() self.assertRaises(lib_exc.BadRequest, self._create_protocol, idp_id, protocol_id, mapping_id)
def test_identity_provider_create(self): idp_id = data_utils.rand_uuid_hex() idp_ref = fixtures.idp_ref() idp = self._create_idp(idp_id, idp_ref) # The identity provider is disabled by default idp_ref['enabled'] = False # The remote_ids attribute should be set to an empty list by default idp_ref['remote_ids'] = [] self._assert_identity_provider_attributes(idp, idp_id, idp_ref)
def test_add_protocol_to_identity_provider_unknown_mapping(self): # Create an identity provider idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref(enabled=True)) # Now we try to add a protocol to the identity provider using # a non existent mapping ID mapping_id = data_utils.rand_uuid_hex() protocol_id = data_utils.rand_uuid_hex() protocol = self._create_protocol(idp_id, protocol_id, mapping_id) self._assert_protocol_attributes(protocol, protocol_id, mapping_id)
def _create_identity_provider_and_mapping(self): # Create an identity provider idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref(enabled=True)) # Create a mapping rule mapping_id = data_utils.rand_uuid_hex() self.mappings_client.create_mapping_rule( mapping_id, fixtures.mapping_ref()) self.addCleanup(self.mappings_client.delete_mapping_rule, mapping_id) return idp_id, mapping_id
def test_identity_provider_update(self): idp_id = data_utils.rand_uuid_hex() idp = self._create_idp(idp_id, fixtures.idp_ref(enabled=True)) # The identity provider should be enabled self.assertTrue(idp['enabled']) idp = self.idps_client.update_identity_provider( idp_id, enabled=False)['identity_provider'] # The identity provider should be disabled self.assertFalse(idp['enabled'])
def _create_identity_provider_and_mapping(self): # Create an identity provider idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref(enabled=True)) # Create a mapping rule mapping_id = data_utils.rand_uuid_hex() self.mappings_client.create_mapping_rule(mapping_id, fixtures.mapping_ref()) self.addCleanup(self.mappings_client.delete_mapping_rule, mapping_id) return idp_id, mapping_id
def test_identity_provider_list(self): idp_ids = [] for _ in range(3): idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref()) idp_ids.append(idp_id) idp_list = self.idps_client.list_identity_providers()[ 'identity_providers'] fetched_ids = [fetched_idp['id'] for fetched_idp in idp_list] for idp_id in idp_ids: self.assertIn(idp_id, fetched_ids)
def test_identity_provider_list(self): idp_ids = [] for _ in range(3): idp_id = data_utils.rand_uuid_hex() self._create_idp(idp_id, fixtures.idp_ref()) idp_ids.append(idp_id) idp_list = self.idps_client.list_identity_providers( )['identity_providers'] fetched_ids = [fetched_idp['id'] for fetched_idp in idp_list] for idp_id in idp_ids: self.assertIn(idp_id, fetched_ids)
def test_identity_provider_create_with_enabled_true(self): idp_id = data_utils.rand_uuid_hex() idp_ref = fixtures.idp_ref(enabled=True) idp = self._create_idp(idp_id, idp_ref) self._assert_identity_provider_attributes(idp, idp_id, idp_ref)