Added signature test for OAuthEcho
This commit is contained in:
parent
ed01a23da1
commit
50a7039f52
@ -1,7 +1,8 @@
|
|||||||
var vows = require('vows'),
|
var vows = require('vows'),
|
||||||
assert = require('assert'),
|
assert = require('assert'),
|
||||||
events = require('events'),
|
events = require('events'),
|
||||||
OAuth= require('../lib/oauth').OAuth;
|
OAuth= require('../lib/oauth').OAuth,
|
||||||
|
OAuthEcho= require('../lib/oauth').OAuthEcho;
|
||||||
|
|
||||||
vows.describe('OAuth').addBatch({
|
vows.describe('OAuth').addBatch({
|
||||||
'When generating the signature base string described in http://oauth.net/core/1.0/#sig_base_example': {
|
'When generating the signature base string described in http://oauth.net/core/1.0/#sig_base_example': {
|
||||||
@ -124,6 +125,19 @@ vows.describe('OAuth').addBatch({
|
|||||||
assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0",oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"');
|
assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0",oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'When get the OAuth Echo authorization header': {
|
||||||
|
topic: function () {
|
||||||
|
var realm = "http://foobar.com/";
|
||||||
|
var verifyCredentials = "http://api.foobar.com/verify.json";
|
||||||
|
var oa = new OAuthEcho(realm, verifyCredentials, "consumerkey", "consumersecret", "1.0A", "HMAC-SHA1");
|
||||||
|
oa._getTimestamp= function(){ return "1272399856"; }
|
||||||
|
oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
|
||||||
|
return oa;
|
||||||
|
},
|
||||||
|
'Provide a valid signature when a token and token secret is present': function (oa) {
|
||||||
|
assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth realm="http://foobar.com/",oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0A",oauth_signature="0rr1LhSxACX2IEWRq3uCb4IwtOs%3D"');
|
||||||
|
}
|
||||||
|
},
|
||||||
'When non standard ports are used': {
|
'When non standard ports are used': {
|
||||||
topic: function() {
|
topic: function() {
|
||||||
var oa= new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
|
var oa= new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user