test/oauth/access_token_test.rb in rack-oauth2-server-2.0.0.beta3 vs test/oauth/access_token_test.rb in rack-oauth2-server-2.0.0.beta4
- old
+ new
@@ -101,11 +101,11 @@
should_fail_authentication :invalid_token
end
context "revoked HTTP token" do
setup do
- Rack::OAuth2::Server::AccessToken.from_token(@token).revoke!
+ Server::AccessToken.from_token(@token).revoke!
with_token
get "/private"
end
should_fail_authentication :invalid_token
end
@@ -255,11 +255,11 @@
end
end
context "list tokens" do
setup do
- @other = Rack::OAuth2::Server.get_token_for("foobar", client.id, "read").token
+ @other = Server.token_for("foobar", client.id, "read")
get "/list_tokens"
end
should "return access token" do
assert_contains last_response.body.split, @token
@@ -268,32 +268,9 @@
should "not return other resource's token" do
assert !last_response.body.split.include?(@other)
end
end
-
- context "get_token_for" do
- should "return two different tokens for two different clients" do
- myapp = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "read write")
- yourapp = Rack::OAuth2::Server.get_token_for("Batman", "4fff30423321e895cb000001", "read write")
- assert myapp.token != yourapp.token
- end
- should "return two different tokens for two different identities" do
- me = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "read write")
- you = Rack::OAuth2::Server.get_token_for("Robin", "4cca30423321e895cb000001", "read write")
- assert me.token != you.token
- end
- should "return two different tokens for two different scope" do
- write = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "read write")
- math = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "read math")
- assert write.token != math.token
- end
- should "return same tokens regardless of order of scope" do
- one = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "read write math")
- two = Rack::OAuth2::Server.get_token_for("Batman", "4cca30423321e895cb000001", "math write read")
- assert_equal one.token, two.token
- end
- end
context "with specific host" do
context "right host" do
setup do
get "http://example.org/public"