Fix identity tests

This commit is contained in:
Stanko K.R.
2025-12-04 18:29:18 +01:00
parent 26fc9ecad4
commit 259707bf70
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -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 -1
View File
@@ -1,6 +1,6 @@
class IdentitiesController < ApplicationController
disallow_account_scope
def show
@identity = Current.identity
end
-2
View File
@@ -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)
+1 -1
View File
@@ -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
+5 -3
View File
@@ -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