still no luck

This commit is contained in:
David Cook
2025-02-03 14:19:42 +11:00
parent c2dd1b2402
commit 46ef03a3d8
2 changed files with 7 additions and 2 deletions

View File

@@ -72,7 +72,8 @@ class DfcRequest
# It results in an empty config hash and we lose our config.
)
client = strategy.client
client.token_endpoint = strategy.config.token_endpoint # tried to mock this but doesn't work.
binding.pry
client.token_endpoint = strategy.config.token_endpoint # can't work out what's happening under the hood or how to stub it
client.refresh_token = @user.oidc_account.refresh_token
token = client.access_token!

View File

@@ -93,7 +93,11 @@ RSpec.describe DfcRequest do
before do
stub_request(:get, "http://example.net/api").
to_return(status: 401)
allow_any_instance_of(OpenIDConnect::Client).to receive(:config).and_return(double(token_endpoint: ""))
# allow_any_instance_of(OpenIDConnect::Client).to receive(:config).and_return(double(token_endpoint: ""))
stub_request(:get, "https://login.lescommuns.org/auth/realms/data-food-consortium/.well-known/openid-configuration").
to_return(status: 200, body: {token_endpoint: "/token"}.to_json)
account.refresh_token = ENV.fetch("OPENID_REFRESH_TOKEN")
account.token = "anything"