Sha256: cd6aed9e46a3afc44aaa34e3660bc1fb1d8a94de74a9a6231ddeffe876c66286
Contents?: true
Size: 885 Bytes
Versions: 21
Compression:
Stored size: 885 Bytes
Contents
require 'rest-core/test' describe RC::Oauth2Header do env = {RC::REQUEST_HEADERS => {}} auth = RC::Oauth2Header.new(RC::Dry.new) would 'do nothing if no access token' do auth.call(env){ |res| res.should.eq(env) } end would 'Bearer token' do auth.call(env.merge('access_token_type' => 'Bearer', 'access_token' => 'token')){ |res| res[RC::REQUEST_HEADERS].should.eq 'Authorization' => 'Bearer token' } end would 'MAC token' do # http://tools.ietf.org/html/rfc6749#section-7.1 auth.call(env.merge('access_token_type' => 'MAC', 'access_token' => {'id' => 'h480djs93hd8', 'mac' => 'kDZvddkndxv='})){ |res| res[RC::REQUEST_HEADERS].should.eq \ 'Authorization' => 'MAC id="h480djs93hd8", mac="kDZvddkndxv="' } end end
Version data entries
21 entries across 21 versions & 1 rubygems