Sha256: 1bbc349e5779f9fb926f85cb8ba73c151d6c78662b6e25f6f320496f64e01bef
Contents?: true
Size: 1.46 KB
Versions: 13
Compression:
Stored size: 1.46 KB
Contents
require 'helper' class TestExvoAuth < Test::Unit::TestCase def setup ExvoAuth::Config.client_id = "foo" ExvoAuth::Config.client_secret = "bar" end test "consumer sanity" do c = ExvoAuth::Autonomous::Consumer.new(:app_id => "baz") authorization = { "access_token" => "qux", "url" => "https://foo/api" } auth = stub(:get => { "authorization" => authorization }) c.expects(:auth).returns(auth) assert_equal authorization, c.send(:authorization) assert_equal authorization, c.send(:authorization) # second time from cache, without touching httparty end test "provider sanity" do p = ExvoAuth::Autonomous::Provider.new(:app_id => "baz", :access_token => "qux") auth = stub(:get => {"scope" => "qux quux"}) p.expects(:auth).returns(auth) assert_equal ["qux", "quux"], p.scopes assert_equal ["qux", "quux"], p.scopes # second time from cache, without touching httparty end test "integration of httparty interface with auth" do c = ExvoAuth::Autonomous::Consumer.new(:app_id => "baz") basement = mock("basement") basement.expects(:base_uri) basement.expects(:basic_auth) basement.expects(:get).with("/bar").returns(true) c.expects(:basement).at_least_once.returns(basement) assert_true c.get("/bar") end test "basement includes httparty" do c = ExvoAuth::Autonomous::Consumer.new(:app_id => "baz") assert_true c.send(:basement).included_modules.include?(HTTParty) end end
Version data entries
13 entries across 13 versions & 1 rubygems