From 9931b1e673500ddfeb4101c837fe4173c626befb Mon Sep 17 00:00:00 2001 From: Zainan Victor Zhou Date: Sat, 15 Jun 2013 00:03:32 -0700 Subject: [PATCH] Fix the test, publish as 0.1.1 --- package.json | 4 ++-- test/strategy-test.js | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 7fb70b4..16ffa0d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "passport-renren", - "version": "0.1.0", - "description": "GitHub authentication strategy for Passport.", + "version": "0.1.1", + "description": "Renren authentication strategy for Passport.", "keywords": ["passport", "renren", "auth", "authn", "authentication", "identity"], "repository": { "type": "git", diff --git a/test/strategy-test.js b/test/strategy-test.js index 06e70c7..3d9f1f9 100644 --- a/test/strategy-test.js +++ b/test/strategy-test.js @@ -78,9 +78,9 @@ vows.describe('RenrenStrategy').addBatch({ function() {}); // mock - strategy._oauth2.get = function(url, accessToken, callback) { - if (url == 'https://api.renren.com/v2/user') { - var body = '{ "login": "octocat", "id": 1, "name": "monalisa octocat", "email": "octocat@renren.com", "html_url": "https://renren.com/octocat" }'; + strategy._oauth2._request = function(method, url, headers, post_body, access_token, callback) { + if(url === "https://api.renren.com/restserver.do?access_token=access-token&format=json&method=users.getInfo") { + var body = '[{"uid":1,"tinyurl":"http://tinyurl.jpg","vip":1,"sex":1,"name": "octocat","star":1,"headurl":"http://headurl.jpg","zidou":0}]'; callback(null, body, undefined); } else { callback(new Error('Incorrect user profile URL')); @@ -108,11 +108,11 @@ vows.describe('RenrenStrategy').addBatch({ 'should load profile' : function(err, profile) { assert.equal(profile.provider, 'renren'); assert.equal(profile.id, '1'); - assert.equal(profile.username, 'octocat'); - assert.equal(profile.displayName, 'monalisa octocat'); - assert.equal(profile.profileUrl, 'https://renren.com/octocat'); - assert.lengthOf(profile.emails, 1); - assert.equal(profile.emails[0].value, 'octocat@renren.com'); + assert.equal(profile.tinyurl, 'http://tinyurl.jpg'); + assert.equal(profile.displayName, 'octocat'); + assert.equal(profile.vip, 1); + assert.equal(profile.name, 'octocat'); + assert.equal(profile.star, 1); }, 'should set raw property' : function(err, profile) { assert.isString(profile._raw); @@ -132,7 +132,7 @@ vows.describe('RenrenStrategy').addBatch({ function() {}); // mock - strategy._oauth2.get = function(url, accessToken, callback) { + strategy._oauth2._request = function(method, url, headers, post_body, access_token, callback) { callback(new Error('something-went-wrong')); }