<s> import mock <EOL> from rally . plugins . openstack . scenarios . ceilometer import samples <EOL> from tests . unit import test <EOL> class CeilometerSamplesTestCase ( test . ScenarioTestCase ) : <EOL> def test_all_list_samples ( self ) : <EOL> scenario = samples . CeilometerSamples ( self . context ) <EOL> scenario . list_matched_samples = mock . MagicMock ( ) <EOL> metadata_query = { "<STR_LIT:a>" : "<STR_LIT:test>" } <EOL> limit = <NUM_LIT:10> <EOL> scenario . list_samples ( metadata_query , limit ) <EOL> scenario . list_matched_samples . assert_any_call ( limit = <NUM_LIT:10> ) <EOL> scenario . list_matched_samples . assert_any_call ( <EOL> metadata_query = metadata_query ) <EOL> scenario . list_matched_samples . assert_any_call ( <EOL> filter_by_resource_id = True ) <EOL> scenario . list_matched_samples . assert_any_call ( <EOL> filter_by_user_id = True ) <EOL> scenario . list_matched_samples . assert_any_call ( <EOL> filter_by_project_id = True ) <EOL> def test_list_samples_without_limit_and_metadata ( self ) : <EOL> scenario = samples . CeilometerSamples ( self . context ) <EOL> scenario . list_matched_samples = mock . MagicMock ( ) <EOL> scenario . list_samples ( ) <EOL> expected_call_args_list = [ <EOL> mock . call ( filter_by_project_id = True ) , <EOL> mock . call ( filter_by_user_id = True ) , <EOL> mock . call ( filter_by_resource_id = True ) <EOL> ] <EOL> self . assertSequenceEqual ( expected_call_args_list , <EOL> scenario . list_matched_samples . call_args_list ) <EOL> def test_list_matched_samples ( self ) : <EOL> scenario = samples . CeilometerSamples ( self . context ) <EOL> scenario . _list_samples = mock . MagicMock ( ) <EOL> context = { "<STR_LIT:user>" : { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:id>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ "<STR_LIT>" ] } } <EOL> scenario . context = context <EOL> metadata_query = { "<STR_LIT:a>" : "<STR_LIT:test>" } <EOL> limit = <NUM_LIT:10> <EOL> scenario . list_matched_samples ( True , True , True , metadata_query , limit ) <EOL> scenario . _list_samples . assert_called_once_with ( <EOL> [ { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:value>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:value>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:value>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:value>" : "<STR_LIT:test>" , "<STR_LIT>" : "<STR_LIT>" } ] , <EOL> <NUM_LIT:10> ) </s>
