<s> import mock <EOL> from rally . plugins . openstack . context . murano import murano_packages <EOL> from tests . unit import test <EOL> CTX = "<STR_LIT>" <EOL> class MuranoGeneratorTestCase ( test . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( MuranoGeneratorTestCase , self ) . setUp ( ) <EOL> @ staticmethod <EOL> def _get_context ( ) : <EOL> return { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:2> , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> } <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : mock . MagicMock ( ) <EOL> } , <EOL> "<STR_LIT>" : mock . MagicMock ( ) , <EOL> "<STR_LIT>" : [ <EOL> { <EOL> "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } , <EOL> { <EOL> "<STR_LIT:id>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> ] , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT:name>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { "<STR_LIT:name>" : "<STR_LIT>" } <EOL> } <EOL> } <EOL> @ mock . patch ( "<STR_LIT>" % CTX ) <EOL> def test_setup ( self , mock_osclients ) : <EOL> mock_app = mock . MagicMock ( id = "<STR_LIT>" ) <EOL> ( mock_osclients . Clients ( ) . murano ( ) . <EOL> packages . create . return_value ) = mock_app <EOL> murano_ctx = murano_packages . PackageGenerator ( self . _get_context ( ) ) <EOL> murano_ctx . setup ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( murano_ctx . context [ "<STR_LIT>" ] ) ) <EOL> tenant_id = murano_ctx . context [ "<STR_LIT>" ] [ <NUM_LIT:0> ] [ "<STR_LIT>" ] <EOL> self . assertEqual ( [ mock_app ] , <EOL> murano_ctx . context [ "<STR_LIT>" ] [ tenant_id ] [ "<STR_LIT>" ] ) <EOL> @ mock . patch ( "<STR_LIT>" % CTX ) <EOL> @ mock . patch ( "<STR_LIT>" % CTX ) <EOL> def test_cleanup_with_zip ( self , mock_cleanup , mock_osclients ) : <EOL> mock_app = mock . Mock ( id = "<STR_LIT>" ) <EOL> ( mock_osclients . Clients ( ) . murano ( ) . <EOL> packages . create . return_value ) = mock_app <EOL> murano_ctx = murano_packages . PackageGenerator ( self . _get_context ( ) ) <EOL> murano_ctx . setup ( ) <EOL> murano_ctx . cleanup ( ) <EOL> mock_cleanup . assert_called_once_with ( names = [ "<STR_LIT>" ] , <EOL> users = murano_ctx . context [ "<STR_LIT>" ] ) <EOL> @ mock . patch ( "<STR_LIT>" % CTX ) <EOL> @ mock . patch ( "<STR_LIT>" % CTX ) <EOL> def test_cleanup_with_dir ( self , mock_cleanup , mock_osclients ) : <EOL> mock_app = mock . Mock ( id = "<STR_LIT>" ) <EOL> ( mock_osclients . Clients ( ) . murano ( ) . <EOL> packages . create . return_value ) = mock_app <EOL> ctx_dict = self . _get_context ( ) <EOL> app_dir = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ctx_dict [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ "<STR_LIT>" ] = app_dir <EOL> murano_ctx = murano_packages . PackageGenerator ( ctx_dict ) <EOL> murano_ctx . setup ( ) <EOL> murano_ctx . cleanup ( ) <EOL> mock_cleanup . assert_called_once_with ( names = [ "<STR_LIT>" ] , <EOL> users = murano_ctx . context [ "<STR_LIT>" ] ) </s>
