#NEWLINE# @ mock . patch . object ( snapshotops . SnapshotOps , '_snapshot' ) #NEWLINE# def test_snapshot_instance_not_found( self , mock_snapshot ) : #NEWLINE# #INDENT# mock_instance = fake_instance . fake_instance_obj ( self . context ) #NEWLINE# mock_snapshot . side_effect = os_win_exc . HyperVVMNotFoundException ( vm_name = mock_instance . name ) #NEWLINE# self . assertRaises ( exception . InstanceNotFound , self . _snapshotops . snapshot , self . context , mock_instance , mock . sentinel . image_id , mock . sentinel . update_task_state ) #NEWLINE# mock_snapshot . assert_called_once_with ( self . context , mock_snapshot , mock . sentinel . image_id , mock . sentinel . update_task_state )