mirror of
https://github.com/openSUSE/osem.git
synced 2026-04-28 02:41:25 -04:00
Test for ichain authentication
This commit is contained in:
@@ -71,7 +71,7 @@ class User < ActiveRecord::Base
|
||||
user.update_attributes(email: attributes[:email])
|
||||
else
|
||||
begin
|
||||
user = create(username: username, email: attributes[:email])
|
||||
user = create!(username: username, email: attributes[:email])
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
raise IChainRecordNotFound
|
||||
end
|
||||
|
||||
@@ -12,6 +12,12 @@ describe User do
|
||||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
it 'User.for_ichain_username raises exception if user is disabled' do
|
||||
user.is_disabled = true
|
||||
user.save
|
||||
expect{User.for_ichain_username(user.username, email: user.email)}.to raise_error(UserDisabled)
|
||||
end
|
||||
|
||||
it 'returns the correct role' do
|
||||
expect(user_admin.is_admin).to eq(true)
|
||||
expect(organizer.roles.first).to eq(organizer_role)
|
||||
|
||||
Reference in New Issue
Block a user