require 'byebug'
request_id = 80
r = Request.find(request_id)
# add persona based on current user's role
req = {:headers => r.context['headers'].merge('x-rh-persona' => 'approval/admin'),
:original_url => r.context['original_url']}
byebug
Insights::API::Common::Request.current = req
user = UserContext.new(Insights::API::Common::Request.current, {})
ActsAsTenant.with_tenant(Tenant.find_by(:external_tenant => Insights::API::Common::Request.current.tenant)) do
r = Request.find(request_id)
s = RequestPolicy::Scope.new(user, Request)
start = Time.now.to_f
s.resolve.to_a
stop = Time.now.to_f
puts "lapsed time: #{1000*(stop-start)}"
end