11defmodule Hex.OAuthTest do
22 use HexTest.IntegrationCase
33
4- describe "get_token/1 " do
4+ describe "get_token/0 " do
55 test "returns error when no tokens are stored" do
6- assert { :error , :no_auth } = Hex.OAuth . get_token ( :read )
7- assert { :error , :no_auth } = Hex.OAuth . get_token ( :write )
6+ assert { :error , :no_auth } = Hex.OAuth . get_token ( )
87 end
98
109 test "returns valid token when available and not expired" do
@@ -18,9 +17,7 @@ defmodule Hex.OAuthTest do
1817
1918 Hex.OAuth . store_token ( token_data )
2019
21- # Same token for both read and write
22- assert { :ok , "test_token" } = Hex.OAuth . get_token ( :read )
23- assert { :ok , "test_token" } = Hex.OAuth . get_token ( :write )
20+ assert { :ok , "test_token" } = Hex.OAuth . get_token ( )
2421 end
2522
2623 test "returns error when token is expired and no refresh possible" do
@@ -33,7 +30,7 @@ defmodule Hex.OAuthTest do
3330
3431 Hex.OAuth . store_token ( token_data )
3532
36- assert { :error , :token_expired } = Hex.OAuth . get_token ( :read )
33+ assert { :error , :token_expired } = Hex.OAuth . get_token ( )
3734 end
3835
3936 test "returns error when token is expired and refresh fails" do
@@ -48,7 +45,7 @@ defmodule Hex.OAuthTest do
4845 Hex.OAuth . store_token ( token_data )
4946
5047 # Should fail to refresh and return error
51- assert { :error , :refresh_failed } = Hex.OAuth . get_token ( :write )
48+ assert { :error , :refresh_failed } = Hex.OAuth . get_token ( )
5249 end
5350 end
5451
@@ -190,7 +187,7 @@ defmodule Hex.OAuthTest do
190187 end
191188 end
192189
193- describe "refresh_token/1 " do
190+ describe "refresh_token/0 " do
194191 test "returns error when no refresh token available" do
195192 token_data = % {
196193 "access_token" => "token_without_refresh" ,
@@ -199,11 +196,11 @@ defmodule Hex.OAuthTest do
199196
200197 Hex.OAuth . store_token ( token_data )
201198
202- assert { :error , :no_refresh_token } = Hex.OAuth . refresh_token ( :write )
199+ assert { :error , :no_refresh_token } = Hex.OAuth . refresh_token ( )
203200 end
204201
205202 test "returns error when no tokens stored" do
206- assert { :error , :no_auth } = Hex.OAuth . refresh_token ( :read )
203+ assert { :error , :no_auth } = Hex.OAuth . refresh_token ( )
207204 end
208205 end
209206end
0 commit comments