'Force _update_router_gw_info failure and see
the exception is propagated.'

def test_create_router_gateway_fails(self):

    plugin = directory.get_plugin(plugin_constants.L3)
    ctx = context.Context('', 'foo')
    class MyException(Exception, ):
        pass
    mock.patch.object(plugin, '_update_router_gw_info', side_effect=MyException).start()
    with self.network() as n:
        data = {'router': {'name': 'router1', 'admin_state_up': True, 'tenant_id': ctx.tenant_id, 'external_gateway_info': {'network_id': n['network']['id']}}}
        self.assertRaises(MyException, plugin.create_router, ctx, data)
        routers = plugin.get_routers(ctx)
        self.assertEqual(0, len(routers))
