29 lines
721 B
Ruby
29 lines
721 B
Ruby
require 'sidekiq/testing'
|
|
|
|
ldap = LdapService.new
|
|
|
|
Sidekiq::Testing.inline! do
|
|
ldap.delete_all_users!
|
|
|
|
puts "Create user: admin"
|
|
|
|
CreateAccount.call(account: {
|
|
username: "admin", domain: "kosmos.org", email: "admin@example.com",
|
|
password: "admin is admin", confirmed: true
|
|
})
|
|
|
|
ldap.add_attribute "cn=admin,ou=kosmos.org,cn=users,dc=kosmos,dc=org", :admin, "true"
|
|
|
|
puts "Create 35 random users"
|
|
35.times do |n|
|
|
username = Faker::Name.unique.first_name.downcase
|
|
email = Faker::Internet.unique.email
|
|
next if username.length < 3
|
|
|
|
CreateAccount.call(account: {
|
|
username: username, domain: "kosmos.org", email: email,
|
|
password: "user is user", confirmed: true
|
|
})
|
|
end
|
|
end
|