<s> import mock <EOL> from rally . plugins . openstack . scenarios . zaqar import basic <EOL> from tests . unit import test <EOL> BASE = "<STR_LIT>" <EOL> BASIC = BASE + "<STR_LIT>" <EOL> class ZaqarBasicTestCase ( test . ScenarioTestCase ) : <EOL> @ mock . patch ( BASIC + "<STR_LIT>" , return_value = "<STR_LIT>" ) <EOL> def test_create_queue ( self , mock_generate_random_name ) : <EOL> scenario = basic . ZaqarBasic ( self . context ) <EOL> scenario . _queue_create = mock . MagicMock ( ) <EOL> scenario . create_queue ( fakearg = "<STR_LIT>" ) <EOL> scenario . _queue_create . assert_called_once_with ( fakearg = "<STR_LIT>" ) <EOL> @ mock . patch ( BASIC + "<STR_LIT>" , return_value = "<STR_LIT>" ) <EOL> def test_producer_consumer ( self , mock_generate_random_name ) : <EOL> scenario = basic . ZaqarBasic ( self . context ) <EOL> messages = [ { "<STR_LIT:body>" : { "<STR_LIT:id>" : idx } , "<STR_LIT>" : <NUM_LIT> } for idx <EOL> in range ( <NUM_LIT:20> ) ] <EOL> queue = mock . MagicMock ( ) <EOL> scenario . _queue_create = mock . MagicMock ( return_value = queue ) <EOL> scenario . _messages_post = mock . MagicMock ( ) <EOL> scenario . _messages_list = mock . MagicMock ( ) <EOL> scenario . _queue_delete = mock . MagicMock ( ) <EOL> scenario . producer_consumer ( min_msg_count = <NUM_LIT:20> , max_msg_count = <NUM_LIT:20> , <EOL> fakearg = "<STR_LIT>" ) <EOL> scenario . _queue_create . assert_called_once_with ( fakearg = "<STR_LIT>" ) <EOL> scenario . _messages_post . assert_called_once_with ( queue , messages , <EOL> <NUM_LIT:20> , <NUM_LIT:20> ) <EOL> scenario . _messages_list . assert_called_once_with ( queue ) <EOL> scenario . _queue_delete . assert_called_once_with ( queue ) </s>
