@@ -42,6 +42,8 @@ class IdentityTests(test.TestCase):
4242 ENDPOINT_LIST_HEADERS = ['ID' , 'Region' , 'Service Name' , 'Service Type' ,
4343 'Enabled' , 'Interface' , 'URL' ]
4444
45+ IDENTITY_PROVIDER_FIELDS = ['description' , 'enabled' , 'id' , 'remote_ids' ]
46+
4547 @classmethod
4648 def setUpClass (cls ):
4749 if hasattr (super (IdentityTests , cls ), 'setUpClass' ):
@@ -253,3 +255,20 @@ def _create_dummy_endpoint(self, interface='public', add_clean_up=True):
253255 self .openstack ,
254256 'endpoint delete %s' % endpoint ['id' ])
255257 return endpoint ['id' ]
258+
259+ def _create_dummy_idp (self , add_clean_up = True ):
260+ identity_provider = data_utils .rand_name ('IdentityProvider' )
261+ description = data_utils .rand_name ('description' )
262+ raw_output = self .openstack (
263+ 'identity provider create '
264+ ' %(name)s '
265+ '--description %(description)s '
266+ '--enable ' % {'name' : identity_provider ,
267+ 'description' : description })
268+ items = self .parse_show (raw_output )
269+ self .assert_show_fields (items , self .IDENTITY_PROVIDER_FIELDS )
270+ if add_clean_up :
271+ self .addCleanup (
272+ self .openstack ,
273+ 'identity provider delete %s' % identity_provider )
274+ return identity_provider
0 commit comments