#NEWLINE# def test_get_plan( self ) : #NEWLINE# #INDENT# self . expected_plan . files = { #NEWLINE# #INDENT# 'some-name.yaml' : { #NEWLINE# #INDENT# 'contents' : 'some fake contents' , #NEWLINE# 'meta' : { #NEWLINE# #INDENT# 'file-type' : 'environment' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . plan_store . get = mock . MagicMock ( return_value = self . expected_plan ) #NEWLINE# plan_mgr = plan . PlanManager ( self . plan_store , self . heatclient ) #NEWLINE# self . assertEqual ( self . expected_plan , plan_mgr . get_plan ( self . plan_name ) , 'Plan mismatch' ) #NEWLINE# self . plan_store . get . assert_called_with ( self . plan_name ) #NEWLINE# with mock . patch ( 'tripleo_common.core.plan.LOG' ) as log_mock : #NEWLINE# #INDENT# self . plan_store . get = mock . Mock ( side_effect = swiftexceptions . ClientException ( 'test-error' , http_status = 404 ) ) #NEWLINE# self . assertRaises ( exception . PlanDoesNotExistError , plan_mgr . get_plan , self . plan_name ) #NEWLINE# log_mock . exception . assert_called_with ( 'Swift error retrieving plan.' ) #NEWLINE# self . plan_store . get = mock . Mock ( side_effect = ValueError ( ) ) #NEWLINE# self . assertRaises ( ValueError , plan_mgr . get_plan , 'overcloud' ) #NEWLINE# log_mock . exception . assert_called_with ( 'Error retrieving plan.' )