Skip to content

Commit

Permalink
Test Response parses and AccessToken in correct
Browse files Browse the repository at this point in the history
  • Loading branch information
scrogson committed Mar 16, 2015
1 parent e3e9ca2 commit cdadac1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/oauth2/access_token_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
defmodule OAuth2.AccessTokenTest do
use ExUnit.Case, async: true

alias OAuth2.Response
alias OAuth2.AccessToken
alias OAuth2.Strategy.AuthCode

test "new with 'expires' param" do
response = Response.new(200, [{"Content-Type", "text/plain"}], "access_token=abc123&expires=123")
token = AccessToken.new(response.body, %AuthCode{})
assert token.strategy == %AuthCode{}
assert token.access_token == "abc123"
assert token.expires_at == 123
assert token.token_type == "Bearer"
assert token.other_params == %{"expires" => "123"}
end

test "expires?" do
assert AccessToken.expires?(%AccessToken{expires_at: 0})
Expand Down

0 comments on commit cdadac1

Please sign in to comment.