Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

AuthToken: test if token_lifetime is overridable #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/model/knock/auth_token_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ class AuthTokenTest < ActiveSupport::TestCase
end
end

test "token_lifetime is overridable" do
Knock.token_lifetime = nil

custom_expiration = 30.minutes.from_now.to_i
token = AuthToken.new(payload: {sub: 'foo', exp: custom_expiration}).token
Timecop.travel(10.years.from_now) do
assert AuthToken.new(token: token).payload.has_key?('exp')
end
end

test "validate aud when verify_options[:verify_aud] is true" do
verify_options = {
verify_aud: true
Expand Down