<s> import mock <EOL> from cloudferry . lib . os . actions import convert_volume_to_image <EOL> from cloudferry . lib . utils import utils <EOL> from tests import test <EOL> class ConverterVolumeToImageTest ( test . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ConverterVolumeToImageTest , self ) . setUp ( ) <EOL> self . fake_src_cloud = mock . Mock ( ) <EOL> self . fake_storage = mock . Mock ( ) <EOL> self . fake_storage . deploy = mock . Mock ( ) <EOL> self . fake_storage . upload_volume_to_image . return_value = ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . fake_storage . get_backend . return_value = '<STR_LIT>' <EOL> self . fake_image = mock . Mock ( ) <EOL> self . fake_image . wait_for_status = mock . Mock ( ) <EOL> self . fake_image . get_image_by_id_converted = mock . Mock ( ) <EOL> self . fake_image . get_image_by_id_converted . return_value = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT:image>' : '<STR_LIT>' , '<STR_LIT>' : { } } } } <EOL> self . fake_image . patch_image = mock . Mock ( ) <EOL> self . fake_src_cloud . resources = { '<STR_LIT>' : self . fake_storage , <EOL> '<STR_LIT:image>' : self . fake_image } <EOL> self . fake_volumes_info = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:image>' : '<STR_LIT:image>' , <EOL> } , <EOL> } } , <EOL> } <EOL> self . fake_dst_cloud = mock . Mock ( ) <EOL> self . fake_config = utils . ext_dict ( migrate = utils . ext_dict ( <EOL> { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) ) <EOL> self . fake_init = { <EOL> '<STR_LIT>' : self . fake_src_cloud , <EOL> '<STR_LIT>' : self . fake_dst_cloud , <EOL> '<STR_LIT>' : self . fake_config <EOL> } <EOL> def test_action ( self ) : <EOL> fake_action = convert_volume_to_image . ConvertVolumeToImage ( <EOL> self . fake_init , <EOL> cloud = '<STR_LIT>' ) <EOL> res = fake_action . run ( self . fake_volumes_info ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> res [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT:image>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> res [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ <EOL> '<STR_LIT>' ] [ '<STR_LIT>' ] ) </s>
