Skip to content

Delete share_ey_sso_backend mock hooks #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions lib/ey-core/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,6 @@ class Mock
include Ey::Core::Mock::Helper
extend Ey::Core::Mock::Util

def self.share_ey_sso_backend!
@share_ey_sso_backend = true
end

def self.share_ey_sso_backend?
@share_ey_sso_backend
end

def share_ey_sso_backend?
self.class.share_ey_sso_backend?
end

def self.for(type, options={})
case type
when :server
Expand Down
17 changes: 0 additions & 17 deletions lib/ey-core/mock/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@ def resource_identity(params)
def find(collection, id_or_url)
id = resource_identity(id_or_url)

if share_ey_sso_backend? && id
case collection
when :accounts then
if sso_account = EY::SSO::Account.get(id)
self.data[:accounts][id] ||= mock_account_setup(sso_account.id, :name => sso_account.name)
end
when :users
if sso_user = EY::SSO::User.get(id)
self.data[:users][id] ||= {
"id" => id,
"email" => sso_user.email,
"accounts" => url_for("/users/#{id}/accounts"),
}
end
end
end

# polymorphic associations suck
if collection.is_a?(Array)
resource = collection.map do |key|
Expand Down
12 changes: 0 additions & 12 deletions lib/ey-core/requests/get_accounts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ def get_accounts(params={})
user_url.split('/').last
end

if share_ey_sso_backend? && user_id
if sso_user = EY::SSO::User.get(user_id)
if sso_user.accounts.exists?
sso_user.accounts.each do |sso_account|
self.data[:accounts][sso_account.id] ||= mock_account_setup(sso_account.id, :name => sso_account.name)
self.data[:accounts][sso_account.id][:account_users] ||= []
self.data[:accounts][sso_account.id][:account_users] << user_id
end
end
end
end

resources = if user_id
find(:users, user_id)
self.data[:accounts].select{|k,v| v[:account_users] && v[:account_users].include?(user_id)}
Expand Down