Fix identity tests
This commit is contained in:
@@ -7,7 +7,7 @@ module Authentication
|
||||
after_action :ensure_development_magic_link_not_leaked
|
||||
helper_method :authenticated?
|
||||
|
||||
etag { Current.session.id if authenticated? }
|
||||
etag { Current.identity.id if authenticated? }
|
||||
|
||||
include LoginHelper
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class IdentitiesController < ApplicationController
|
||||
disallow_account_scope
|
||||
|
||||
|
||||
def show
|
||||
@identity = Current.identity
|
||||
end
|
||||
|
||||
@@ -2,8 +2,6 @@ class Current < ActiveSupport::CurrentAttributes
|
||||
attribute :session, :user, :identity, :account
|
||||
attribute :http_method, :request_id, :user_agent, :ip_address, :referrer
|
||||
|
||||
delegate :identity, to: :session, allow_nil: true
|
||||
|
||||
def session=(value)
|
||||
super(value)
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@ json.accounts @identity.users do |user|
|
||||
json.partial! "identities/account", account: user.account
|
||||
json.user do
|
||||
json.partial! "users/user", user: user
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -73,9 +73,11 @@ class ApiTest < ActionDispatch::IntegrationTest
|
||||
test "get identity" do
|
||||
identity = identities(:david)
|
||||
|
||||
get identity_path(format: :json), env: @davids_bearer_token
|
||||
assert_response :success # Fix 302 redirect
|
||||
assert_equal identity.accounts.count, @response.parsed_body["accounts"].count
|
||||
untenanted do
|
||||
get identity_path(format: :json), env: @davids_bearer_token
|
||||
assert_response :success
|
||||
assert_equal identity.accounts.count, @response.parsed_body["accounts"].count
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user