#NEWLINE# @ mock . patch ( 'nova.compute.flavors.create' , side_effect = exception . FlavorCreateFailed ) #NEWLINE# def test_flavor_create_db_failed( self , mock_create ) : #NEWLINE# #INDENT# request_dict = { #NEWLINE# #INDENT# 'flavor' : { #NEWLINE# #INDENT# 'name' : 'test' , #NEWLINE# 'id' : '12345' , #NEWLINE# 'ram' : 512 , #NEWLINE# 'vcpus' : 2 , #NEWLINE# 'disk' : 1 , #NEWLINE# 'OS-FLV-EXT-DATA:ephemeral' : 1 , #NEWLINE# 'swap' : 512 , #NEWLINE# 'rxtx_factor' : 1 , #NEWLINE# 'os-flavor-access:is_public' : True , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# ex = self . assertRaises ( webob . exc . HTTPInternalServerError , ex . controller . _create , self . _get_http_request ( ) , body = request_dict ) #NEWLINE# self . assertIn ( 'Unable to create flavor' , ex . explanation )