Skip to content

Commit

Permalink
Fix the test, publish as 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xinbenlv committed Jun 15, 2013
1 parent 9f21988 commit 9931b1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 9 additions & 9 deletions test/strategy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]", "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'));
Expand Down Expand Up @@ -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, '[email protected]');
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);
Expand All @@ -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'));
}

Expand Down

0 comments on commit 9931b1e

Please sign in to comment.