Skip to content

Sample code to byebug inside Pod #331

@hsong-rh

Description

@hsong-rh

Only for record, since #327 is closed and not allow to post comments:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions