From cdadac12245b5fd2fa4aff9928fbd70427d08f26 Mon Sep 17 00:00:00 2001 From: Sonny Scroggin Date: Mon, 16 Mar 2015 02:46:49 -0500 Subject: [PATCH] Test Response parses and AccessToken in correct --- test/oauth2/access_token_test.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/oauth2/access_token_test.exs b/test/oauth2/access_token_test.exs index 2b9033c..5be6ede 100644 --- a/test/oauth2/access_token_test.exs +++ b/test/oauth2/access_token_test.exs @@ -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})