Verified Commit 9da32e1e authored by paz's avatar paz

Return nil, not Errors::Unauthorized if authorized but not found.

parent b3d80532
......@@ -85,14 +85,13 @@ describe Schleuder::KeysController do
expect(result.fingerprint).to eq '59C71FB38AEE22E091C78259D06350440F759BD3'
end
it 'returns unauthorized if user is authorized but no key is found for given fingerprint' do
it 'returns nil if user is authorized but no key is found for given fingerprint' do
list = create(:list)
subscription = create(:subscription, list_id: list.id, admin: true)
account = create(:account, email: subscription.email)
expect do
KeysController.new(account).find(list.id, '80C71FB38AEE22E091C78259D06350440F759BD3')
end.to raise_error(Schleuder::Errors::Unauthorized)
key = KeysController.new(account).find(list.id, '80C71FB38AEE22E091C78259D06350440F759BD3')
expect(key).to eql(nil)
end
it 'raises an unauthorized error when the user is not authorized' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment