<s> import warnings <EOL> import mock <EOL> from novaclient . tests . unit . fixture_data import client <EOL> from novaclient . tests . unit . fixture_data import images as data <EOL> from novaclient . tests . unit import utils <EOL> from novaclient . tests . unit . v2 import fakes <EOL> from novaclient . v2 import images <EOL> class ImagesTest ( utils . FixturedTestCase ) : <EOL> client_fixture_class = client . V1 <EOL> data_fixture_class = data . V1 <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_list_images ( self , mock_warn ) : <EOL> il = self . cs . images . list ( ) <EOL> self . assert_request_id ( il , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> for i in il : <EOL> self . assertIsInstance ( i , images . Image ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( il ) ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_warn . call_count ) <EOL> def test_list_images_undetailed ( self ) : <EOL> il = self . cs . images . list ( detailed = False ) <EOL> self . assert_request_id ( il , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> for i in il : <EOL> self . assertIsInstance ( i , images . Image ) <EOL> def test_list_images_with_marker_limit ( self ) : <EOL> il = self . cs . images . list ( marker = <NUM_LIT> , limit = <NUM_LIT:4> ) <EOL> self . assert_request_id ( il , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_get_image_details ( self , mock_warn ) : <EOL> i = self . cs . images . get ( <NUM_LIT:1> ) <EOL> self . assert_request_id ( i , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> self . assertIsInstance ( i , images . Image ) <EOL> self . assertEqual ( <NUM_LIT:1> , i . id ) <EOL> self . assertEqual ( '<STR_LIT>' , i . name ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_warn . call_count ) <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_delete_image ( self , mock_warn ) : <EOL> i = self . cs . images . delete ( <NUM_LIT:1> ) <EOL> self . assert_request_id ( i , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_warn . call_count ) <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_delete_meta ( self , mock_warn ) : <EOL> i = self . cs . images . delete_meta ( <NUM_LIT:1> , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assert_request_id ( i , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_warn . call_count ) <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_set_meta ( self , mock_warn ) : <EOL> i = self . cs . images . set_meta ( <NUM_LIT:1> , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assert_request_id ( i , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assert_called ( '<STR_LIT:POST>' , '<STR_LIT>' , <EOL> { "<STR_LIT>" : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_warn . call_count ) <EOL> @ mock . patch . object ( warnings , '<STR_LIT>' ) <EOL> def test_find ( self , mock_warn ) : <EOL> i = self . cs . images . find ( name = "<STR_LIT>" ) <EOL> self . assert_request_id ( i , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assertEqual ( <NUM_LIT:1> , i . id ) <EOL> self . assert_called ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:2> , mock_warn . call_count ) <EOL> iml = self . cs . images . findall ( status = '<STR_LIT>' ) <EOL> self . assert_request_id ( iml , fakes . FAKE_REQUEST_ID_LIST ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( iml ) ) <EOL> self . assertEqual ( '<STR_LIT>' , iml [ <NUM_LIT:0> ] . name ) </s>
