#NEWLINE# @ mock . patch . object ( six . moves . builtins , 'open' ) #NEWLINE# @ mock . patch ( 'nova.signature_utils.get_verifier' ) #NEWLINE# @ mock . patch ( 'nova.image.glance.LOG' ) #NEWLINE# @ mock . patch ( 'nova.image.glance.GlanceImageService.show' ) #NEWLINE# def test_download_dst_path_signature_fail( self , mock_show , mock_log , mock_get_verifier , mock_open ) : #NEWLINE# #INDENT# mock_get_verifier . return_value = self . BadVerifier ( ) #NEWLINE# mock_dest = mock . MagicMock ( ) #NEWLINE# fake_path = 'FAKE_PATH' #NEWLINE# mock_open . return_value = mock_dest #NEWLINE# mock_show . return_value = self . fake_img_props #NEWLINE# self . assertRaises ( cryptography . exceptions . InvalidSignature , self . service . download , context = None , image_id = None , data = None , dst_path = fake_path ) #NEWLINE# mock_log . error . assert_called_once_with ( mock . ANY , mock . ANY ) #NEWLINE# mock_open . assert_called_once_with ( fake_path , 'wb' ) #NEWLINE# mock_dest . truncate . assert_called_once_with ( 0 ) #NEWLINE# self . assertTrue ( mock_log . close . called )