mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Start to spec DFC auth control
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe DfcProvider::AuthorizationControl do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
describe "with OIDC token" do
|
||||
it "finds a user" do
|
||||
token = JWT.encode({ email: user.email }, nil)
|
||||
auth = described_class.new(
|
||||
double(:request,
|
||||
headers: { "Authorization" => "Bearer #{token}" })
|
||||
)
|
||||
|
||||
expect(auth.user).to eq user
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user