[#10799] Remove dead code

This commit is contained in:
Mathieu Magnin 2024-09-27 17:02:56 +02:00
parent e172f3ed6c
commit c897893e8a
No known key found for this signature in database
GPG key ID: 8DCAFC82D7BA654E
2 changed files with 0 additions and 29 deletions

View file

@ -18,10 +18,6 @@ module APIEntrepriseTokenConcern
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
end
def api_entreprise_token_expired?
APIEntrepriseToken.new(api_entreprise_token).expired?
end
def api_entreprise_token_expired_or_expires_soon?
api_entreprise_token_expires_at && api_entreprise_token_expires_at <= SOON_TO_EXPIRE_DELAY.from_now
end

View file

@ -616,31 +616,6 @@ describe Procedure do
end
end
describe 'api_entreprise_token_expired?' do
let(:token) { "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" }
let(:procedure) { create(:procedure, api_entreprise_token: token) }
let(:payload) {
[
{ "exp" => expiration_time }
]
}
let(:subject) { procedure.api_entreprise_token_expired? }
before do
allow(JWT).to receive(:decode).with(token, nil, false).and_return(payload)
end
context "with token expired" do
let(:expiration_time) { (1.day.ago).to_i }
it { is_expected.to be_truthy }
end
context "with token not expired" do
let(:expiration_time) { (1.day.from_now).to_i }
it { is_expected.to be_falsey }
end
end
describe 'clone' do
let(:service) { create(:service) }
let(:procedure) do