#NEWLINE# @ mock . patch . object ( db_driver . DbDriver , 'is_up' , side_effect = KeyError ) #NEWLINE# def test_services_with_exception( self , mock_is_up ) : #NEWLINE# #INDENT# req = FakeRequestWithHostService ( ) #NEWLINE# self . assertRaises ( self . service_is_up_exc , self . controller . index , req )