<s> from openstackclient . tests . volume . v2 import fakes as service_fakes <EOL> from openstackclient . volume . v2 import service <EOL> class TestService ( service_fakes . TestService ) : <EOL> def setUp ( self ) : <EOL> super ( TestService , self ) . setUp ( ) <EOL> self . service_mock = self . app . client_manager . volume . services <EOL> self . service_mock . reset_mock ( ) <EOL> class TestServiceList ( TestService ) : <EOL> services = service_fakes . FakeService . create_one_service ( ) <EOL> def setUp ( self ) : <EOL> super ( TestServiceList , self ) . setUp ( ) <EOL> self . service_mock . list . return_value = [ self . services ] <EOL> self . cmd = service . ListService ( self . app , None ) <EOL> def test_service_list ( self ) : <EOL> arglist = [ <EOL> '<STR_LIT>' , self . services . host , <EOL> '<STR_LIT>' , self . services . binary , <EOL> ] <EOL> verifylist = [ <EOL> ( '<STR_LIT:host>' , self . services . host ) , <EOL> ( '<STR_LIT>' , self . services . binary ) , <EOL> ] <EOL> parsed_args = self . check_parser ( self . cmd , arglist , verifylist ) <EOL> columns , data = self . cmd . take_action ( parsed_args ) <EOL> expected_columns = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> self . assertEqual ( expected_columns , columns ) <EOL> datalist = ( ( <EOL> self . services . binary , <EOL> self . services . host , <EOL> self . services . zone , <EOL> self . services . status , <EOL> self . services . state , <EOL> self . services . updated_at , <EOL> ) , ) <EOL> self . assertEqual ( datalist , tuple ( data ) ) <EOL> self . service_mock . list . assert_called_with ( <EOL> self . services . host , <EOL> self . services . binary , <EOL> ) <EOL> self . assertNotIn ( "<STR_LIT>" , columns ) <EOL> self . assertNotIn ( self . services . disabled_reason , <EOL> tuple ( data ) ) <EOL> def test_service_list_with_long_option ( self ) : <EOL> arglist = [ <EOL> '<STR_LIT>' , self . services . host , <EOL> '<STR_LIT>' , self . services . binary , <EOL> '<STR_LIT>' <EOL> ] <EOL> verifylist = [ <EOL> ( '<STR_LIT:host>' , self . services . host ) , <EOL> ( '<STR_LIT>' , self . services . binary ) , <EOL> ( '<STR_LIT>' , True ) <EOL> ] <EOL> parsed_args = self . check_parser ( self . cmd , arglist , verifylist ) <EOL> columns , data = self . cmd . take_action ( parsed_args ) <EOL> expected_columns = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> self . assertEqual ( expected_columns , columns ) <EOL> datalist = ( ( <EOL> self . services . binary , <EOL> self . services . host , <EOL> self . services . zone , <EOL> self . services . status , <EOL> self . services . state , <EOL> self . services . updated_at , <EOL> self . services . disabled_reason , <EOL> ) , ) <EOL> self . assertEqual ( datalist , tuple ( data ) ) <EOL> self . service_mock . list . assert_called_with ( <EOL> self . services . host , <EOL> self . services . binary , <EOL> ) </s>
