@@ -384,6 +384,61 @@ def test_identity_provider_list_no_options(self):
384384 ), )
385385 self .assertListItemEqual (datalist , tuple (data ))
386386
387+ def test_identity_provider_list_ID_option (self ):
388+ arglist = ['--id' ,
389+ identity_fakes .idp_id ]
390+ verifylist = [
391+ ('id' , identity_fakes .idp_id )
392+ ]
393+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
394+
395+ # In base command class Lister in cliff, abstract method take_action()
396+ # returns a tuple containing the column names and an iterable
397+ # containing the data to be listed.
398+ columns , data = self .cmd .take_action (parsed_args )
399+
400+ kwargs = {
401+ 'id' : identity_fakes .idp_id
402+ }
403+ self .identity_providers_mock .list .assert_called_with (** kwargs )
404+
405+ collist = ('ID' , 'Enabled' , 'Domain ID' , 'Description' )
406+ self .assertEqual (collist , columns )
407+ datalist = ((
408+ identity_fakes .idp_id ,
409+ True ,
410+ identity_fakes .domain_id ,
411+ identity_fakes .idp_description ,
412+ ), )
413+ self .assertListItemEqual (datalist , tuple (data ))
414+
415+ def test_identity_provider_list_enabled_option (self ):
416+ arglist = ['--enabled' ]
417+ verifylist = [
418+ ('enabled' , True )
419+ ]
420+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
421+
422+ # In base command class Lister in cliff, abstract method take_action()
423+ # returns a tuple containing the column names and an iterable
424+ # containing the data to be listed.
425+ columns , data = self .cmd .take_action (parsed_args )
426+
427+ kwargs = {
428+ 'enabled' : True
429+ }
430+ self .identity_providers_mock .list .assert_called_with (** kwargs )
431+
432+ collist = ('ID' , 'Enabled' , 'Domain ID' , 'Description' )
433+ self .assertEqual (collist , columns )
434+ datalist = ((
435+ identity_fakes .idp_id ,
436+ True ,
437+ identity_fakes .domain_id ,
438+ identity_fakes .idp_description ,
439+ ), )
440+ self .assertListItemEqual (datalist , tuple (data ))
441+
387442
388443class TestIdentityProviderSet (TestIdentityProvider ):
389444
0 commit comments