This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frisby.create('POST missing firstName') | |
.post(tc.url + '/user/enroll', | |
{ 'lastName' : TU1_LN, | |
'email' : TU1_EMAIL, | |
'password' : TU1_PW }) | |
.expectStatus(400) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSON({'error' : 'Undefined First Name'}) | |
.toss() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frisby.create('POST password missing lowercase') | |
.post(tc.url + '/user/enroll', | |
{ 'firstName' : TU1_FN, | |
'lastName' : TU1_LN, | |
'email' : TU1_EMAIL, | |
'password' : 'TESTUSER123' }) | |
.expectStatus(400) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSONTypes({'error' : String}) | |
.toss() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frisby.create('POST invalid email address') | |
.post(tc.url + '/user/enroll', | |
{ 'firstName' : TU1_FN, | |
'lastName' : TU1_LN, | |
'email' : "invalid.email", | |
'password' : 'testUser' }) | |
.expectStatus(400) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSONTypes({'error' : String}) | |
.toss() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_USERS = [{'fn' : 'Test', 'ln' : 'User1', | |
'email' : 'testuser1@example.com', 'pwd' : 'testUser123'}, | |
{'fn' : 'Test', 'ln' : 'User2', | |
'email' : 'testuser2@example.com', 'pwd' : 'testUser123'}, | |
{'fn' : 'Test', 'ln' : 'User3', | |
'email' : 'testuser3@example.com', 'pwd' : 'testUser123'}] | |
SP_APP_NAME = 'Reader Test'; | |
var frisby = require('frisby'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_USERS.forEach(function createUser(user, index, array) { | |
frisby.create('POST enroll user ' + user.email) | |
.post(tc.url + '/user/enroll', | |
{ 'firstName' : user.fn, | |
'lastName' : user.ln, | |
'email' : user.email, | |
'password' : user.pwd }) | |
.expectStatus(201) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSON({ 'firstName' : user.fn, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frisby.create('POST enroll duplicate user ') | |
.post(tc.url + '/user/enroll', | |
{ 'firstName' : TEST_USERS[0].fn, | |
'lastName' : TEST_USERS[0].ln, | |
'email' : TEST_USERS[0].email, | |
'password' : TEST_USERS[0].pwd }) | |
.expectStatus(400) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSON({'error' : 'Account with that email already exists. Please choose another email.'}) | |
.toss() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_USERS = | |
[{ "_id":"54ad6c3ae764de42070b27b1", | |
"email":"testuser1@example.com", | |
"firstName":"Test", | |
"lastName":"User1", | |
"sp_api_key_id":”<API KEY ID>", | |
"sp_api_key_secret":”<API KEY SECRET>” | |
}, | |
{ "_id":"54ad6c3be764de42070b27b2”, | |
"email":"testuser2@example.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TU_EMAIL_REGEX = new RegExp('^testuser*'); | |
SP_APP_NAME = 'Reader Test'; | |
TEST_CREDS_TMP_FILE = '/tmp/readerTestCreds.js'; | |
var async = require('async'); | |
var dbConfig = require('./config/db.js'); | |
var mongodb = require('mongodb'); | |
assert = require('assert'); | |
var mongoClient = mongodb.MongoClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_USERS = require('/tmp/readerTestCreds.js'); | |
var frisby = require('frisby'); | |
var tc = require('./config/test_config'); | |
var async = require('async'); | |
var dbConfig = require('./config/db.js'); | |
var dilbertFeedURL = 'http://feeds.feedburner.com/DilbertDailyStrip'; | |
var nycEaterFeedURL = 'http://feeds.feedburner.com/eater/nyc'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addEmptyFeedListTest(callback) { | |
var user = TEST_USERS[0]; | |
frisby.create('GET empty feed list for user ' + user.email) | |
.get(tc.url + '/feeds') | |
.auth(user.sp_api_key_id, user.sp_api_key_secret) | |
.expectStatus(200) | |
.expectHeader('Content-Type', 'application/json; charset=utf-8') | |
.expectJSON({feeds : []}) | |
.toss() | |
callback(null); |