Update tests for the Internal API

This commit is contained in:
Stanko K.R.
2025-10-22 08:04:52 +02:00
parent 95dc6dc2ed
commit 201c3e27d3
32 changed files with 894 additions and 425 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
# Loop through all tenants and create identities for users
ApplicationRecord.with_each_tenant do |tenant|
puts "Processing tenant: #{tenant}"
User.find_each do |user|
next if user.system?
# Use IdentityProvider to link the user's email to this tenant
# This will find_or_create the identity and link it to the tenant
identity = IdentityProvider.link(email_address: user.email_address, to: tenant)
puts " ✅ Linked identity for user #{user.id} (#{user.email_address}) to tenant '#{tenant}'"
end
puts " Completed tenant: #{tenant}"
puts
end
puts "All identities created successfully!"