From b9c3c432ac1dd0489c86dcbca9527fc6d0804bbe Mon Sep 17 00:00:00 2001 From: Aesop Wolf Date: Fri, 24 Apr 2015 15:11:28 -0700 Subject: [PATCH] refactored test for oauth_body_hash PLAINTEXT signature_method --- tests/test-oauth.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test-oauth.js b/tests/test-oauth.js index a4148a9c8..2da346c10 100644 --- a/tests/test-oauth.js +++ b/tests/test-oauth.js @@ -574,7 +574,7 @@ tape('body_hash automatic built', function(t) { }) tape('body_hash PLAINTEXT signature_method', function(t) { - try { + t.throws(function() { request.post( { url: 'http://example.com' , oauth: @@ -583,11 +583,10 @@ tape('body_hash PLAINTEXT signature_method', function(t) { , signature_method: 'PLAINTEXT' } , json: {foo: 'bar'} - }) - } catch(e) { - process.nextTick(function() { - t.equal(typeof e, 'object') + }, function () { + t.fail('body_hash is not allowed with PLAINTEXT signature_method') t.end() }) - } + }, /oauth: PLAINTEXT signature_method not supported with body_hash signing/) + t.end() })