Sha256: 14828f3033272aa6745bcc40807bb4e8bcc28ba51c7f3fc60d493577eb485082

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

require 'test_helper'

class OproAuthGrantTest < ActiveSupport::TestCase
  test "duplicate access_tokens can't happen" do
    grant     = create_auth_grant
    dup_grant = create_auth_grant
    dup_grant.access_token = grant.access_token
    refute dup_grant.valid?
    assert dup_grant.errors.present?
  end

  test "unique_secure_token_for" do
    grant     = create_auth_grant
    token     = grant.access_token
    new_token = grant.unique_token_for(:access_token, token)
    assert_not_equal token, new_token
  end

  test "no expiration without access_token expiration time" do
    ::Opro.require_refresh_within = nil
    grant = create_auth_grant
    ::Opro.require_refresh_within = 1.day
    refute grant.expired?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opro-0.5.0 test/models/opro/oauth/auth_grant_test.rb
opro-0.4.3 test/models/opro/oauth/auth_grant_test.rb
opro-0.4.2 test/models/opro/oauth/auth_grant_test.rb
opro-0.4.1 test/models/opro/oauth/auth_grant_test.rb