aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkumar <kumar.damani@mail.utoronto.ca>2016-07-27 18:04:42 +0000
committerkumar <kumar.damani@mail.utoronto.ca>2016-07-27 18:04:42 +0000
commit11854aac96d07d7f1f428df693d349b0c38750eb (patch)
tree2dfbdf7dcc1be2b20589dd26914eb77ecbb1c536 /test
parentdd90e9fbeef08b3f25c21e3e3725ce6b7d14ff7a (diff)
parent807b2b72e6b83339ecb4f5f23999ce8d22d9db46 (diff)
pull
Merge branch 'master' of https://github.com/HumairAK/solutions_repo
Diffstat (limited to 'test')
-rw-r--r--test/dbTests/exams_data.json752
-rw-r--r--test/dbTests/resulst.txt19
-rw-r--r--test/dbTests/test_main.js143
-rw-r--r--test/dbTests/testingDocs.txt53
-rw-r--r--test/dbTests/users_data.json552
-rw-r--r--test/routingDb_tests.js22
-rw-r--r--test/test_server.js2
7 files changed, 20 insertions, 1523 deletions
diff --git a/test/dbTests/exams_data.json b/test/dbTests/exams_data.json
deleted file mode 100644
index 493bbf5..0000000
--- a/test/dbTests/exams_data.json
+++ /dev/null
@@ -1,752 +0,0 @@
-[
- {
- "id": 1,
- "serial": 321,
- "course_code": "CSC321",
- "year": 2014,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Sandra Crane",
- "Mcintyre Holmes"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"
- },
- {
- "id": 2,
- "serial": 307,
- "course_code": "CSC307",
- "year": 2013,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Erickson Hess",
- "Frieda Burns"
- ],
- "page_count": 16,
- "questions_count": 16,
- "uploaded_by": "admin0"
- },
- {
- "id": 3,
- "serial": 303,
- "course_code": "CSC303",
- "year": 2016,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Jeanette Chapman",
- "Suzanne Chaney"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 4,
- "serial": 309,
- "course_code": "CSC309",
- "year": 2013,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Jarvis Strickland",
- "Richardson Goodman"
- ],
- "page_count": 12,
- "questions_count": 12,
- "uploaded_by": "admin0"
- },
- {
- "id": 5,
- "serial": 307,
- "course_code": "CSC307",
- "year": 2015,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Jessica Heath",
- "Rosario Pratt"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- },
- {
- "id": 6,
- "serial": 325,
- "course_code": "CSC325",
- "year": 2012,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Virginia Higgins",
- "Paul Owen"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 7,
- "serial": 306,
- "course_code": "CSC306",
- "year": 2013,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Estes Shaw",
- "Wilcox Peterson"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- },
- {
- "id": 8,
- "serial": 324,
- "course_code": "CSC324",
- "year": 2016,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Melinda Clayton",
- "Rosario Hanson"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 9,
- "serial": 304,
- "course_code": "CSC304",
- "year": 2015,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Molina Oneill",
- "Wilkins Knox"
- ],
- "page_count": 15,
- "questions_count": 15,
- "uploaded_by": "admin0"
- },
- {
- "id": 10,
- "serial": 324,
- "course_code": "CSC324",
- "year": 2016,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Brittney Rivas",
- "Walker Morin"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- },
- {
- "id": 11,
- "serial": 300,
- "course_code": "CSC300",
- "year": 2015,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Constance Morgan",
- "Tamra Reid"
- ],
- "page_count": 13,
- "questions_count": 13,
- "uploaded_by": "admin0"
- },
- {
- "id": 12,
- "serial": 306,
- "course_code": "CSC306",
- "year": 2016,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Johns Flowers",
- "Burris Diaz"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 13,
- "serial": 305,
- "course_code": "CSC305",
- "year": 2016,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Allen Quinn",
- "Sandoval Wiley"
- ],
- "page_count": 18,
- "questions_count": 18,
- "uploaded_by": "admin0"
- },
- {
- "id": 14,
- "serial": 309,
- "course_code": "CSC309",
- "year": 2012,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Mueller Nolan",
- "Robyn King"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 15,
- "serial": 303,
- "course_code": "CSC303",
- "year": 2015,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Erma Mullen",
- "Gillespie Odonnell"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"
- },
- {
- "id": 16,
- "serial": 301,
- "course_code": "CSC301",
- "year": 2014,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Tillman Weaver",
- "Walter Haynes"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 17,
- "serial": 313,
- "course_code": "CSC313",
- "year": 2015,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Becky Rivera",
- "Cabrera Vaughan"
- ],
- "page_count": 12,
- "questions_count": 12,
- "uploaded_by": "admin0"
- },
- {
- "id": 18,
- "serial": 318,
- "course_code": "CSC318",
- "year": 2014,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Ofelia Hinton",
- "Terrie Oneil"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 19,
- "serial": 306,
- "course_code": "CSC306",
- "year": 2013,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Hardy Perkins",
- "Lydia Dillon"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- },
- {
- "id": 20,
- "serial": 306,
- "course_code": "CSC306",
- "year": 2016,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Margery Mooney",
- "Justine Walls"
- ],
- "page_count": 18,
- "questions_count": 18,
- "uploaded_by": "admin0"
- },
- {
- "id": 21,
- "serial": 308,
- "course_code": "CSC308",
- "year": 2013,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Cherry Miranda",
- "Gail Dalton"
- ],
- "page_count": 13,
- "questions_count": 13,
- "uploaded_by": "admin0"
- },
- {
- "id": 22,
- "serial": 304,
- "course_code": "CSC304",
- "year": 2014,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Winters Larsen",
- "Kathryn Decker"
- ],
- "page_count": 19,
- "questions_count": 19,
- "uploaded_by": "admin0"
- },
- {
- "id": 23,
- "serial": 312,
- "course_code": "CSC312",
- "year": 2016,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Odessa Blanchard",
- "Lily Jenkins"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"
- },
- {
- "id": 24,
- "serial": 319,
- "course_code": "CSC319",
- "year": 2012,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Christian Mcconnell",
- "Ingrid Russo"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 25,
- "serial": 325,
- "course_code": "CSC325",
- "year": 2012,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Lorie Drake",
- "Wendy Gilliam"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 26,
- "serial": 316,
- "course_code": "CSC316",
- "year": 2016,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Mayra Mercer",
- "Kasey Gamble"
- ],
- "page_count": 13,
- "questions_count": 13,
- "uploaded_by": "admin0"
- },
- {
- "id": 27,
- "serial": 321,
- "course_code": "CSC321",
- "year": 2016,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Clarke Shannon",
- "Poole Emerson"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 28,
- "serial": 307,
- "course_code": "CSC307",
- "year": 2013,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Eugenia Herring",
- "Corine Barnett"
- ],
- "page_count": 18,
- "questions_count": 18,
- "uploaded_by": "admin0"
- },
- {
- "id": 29,
- "serial": 324,
- "course_code": "CSC324",
- "year": 2013,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Sosa Hall",
- "Hallie Walters"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 30,
- "serial": 302,
- "course_code": "CSC302",
- "year": 2014,
- "term": "winter",
- "type": "final",
- "instructors": [
- "King Hopkins",
- "Sanchez Duncan"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 31,
- "serial": 311,
- "course_code": "CSC311",
- "year": 2015,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Higgins Nichols",
- "Nanette Levy"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- },
- {
- "id": 32,
- "serial": 305,
- "course_code": "CSC305",
- "year": 2016,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Dillon Mclean",
- "Lawanda Tillman"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"
- },
- {
- "id": 33,
- "serial": 316,
- "course_code": "CSC316",
- "year": 2015,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Erin Hendrix",
- "Cannon Michael"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 34,
- "serial": 314,
- "course_code": "CSC314",
- "year": 2012,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Norman Schultz",
- "Manning Osborn"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 35,
- "serial": 303,
- "course_code": "CSC303",
- "year": 2014,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Bowen Blevins",
- "Hazel Floyd"
- ],
- "page_count": 12,
- "questions_count": 12,
- "uploaded_by": "admin0"
- },
- {
- "id": 36,
- "serial": 321,
- "course_code": "CSC321",
- "year": 2014,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Jenifer Wade",
- "Connie Day"
- ],
- "page_count": 19,
- "questions_count": 19,
- "uploaded_by": "admin0"
- },
- {
- "id": 37,
- "serial": 304,
- "course_code": "CSC304",
- "year": 2012,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Ernestine Schmidt",
- "Aimee Evans"
- ],
- "page_count": 13,
- "questions_count": 13,
- "uploaded_by": "admin0"
- },
- {
- "id": 38,
- "serial": 319,
- "course_code": "CSC319",
- "year": 2012,
- "term": "summer",
- "type": "midterm",
- "instructors": [
- "Landry Foreman",
- "Melva Koch"
- ],
- "page_count": 10,
- "questions_count": 10,
- "uploaded_by": "admin0"
- },
- {
- "id": 39,
- "serial": 309,
- "course_code": "CSC309",
- "year": 2013,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Hayden Rodriquez",
- "Luann Avila"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 40,
- "serial": 324,
- "course_code": "CSC324",
- "year": 2015,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Ericka Stewart",
- "Darcy Holloway"
- ],
- "page_count": 16,
- "questions_count": 16,
- "uploaded_by": "admin0"
- },
- {
- "id": 41,
- "serial": 313,
- "course_code": "CSC313",
- "year": 2016,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Maria Vasquez",
- "Palmer Sosa"
- ],
- "page_count": 15,
- "questions_count": 15,
- "uploaded_by": "admin0"
- },
- {
- "id": 42,
- "serial": 317,
- "course_code": "CSC317",
- "year": 2014,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Patricia Hunter",
- "Leonard Salazar"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 43,
- "serial": 321,
- "course_code": "CSC321",
- "year": 2013,
- "term": "fall",
- "type": "midterm",
- "instructors": [
- "Ortiz Hart",
- "Yates William"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 44,
- "serial": 320,
- "course_code": "CSC320",
- "year": 2014,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Kathleen Robbins",
- "Moran Blake"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 45,
- "serial": 308,
- "course_code": "CSC308",
- "year": 2013,
- "term": "summer",
- "type": "final",
- "instructors": [
- "Cecile Franklin",
- "Douglas Brooks"
- ],
- "page_count": 20,
- "questions_count": 20,
- "uploaded_by": "admin0"
- },
- {
- "id": 46,
- "serial": 324,
- "course_code": "CSC324",
- "year": 2012,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Marilyn Adkins",
- "Watts Marsh"
- ],
- "page_count": 14,
- "questions_count": 14,
- "uploaded_by": "admin0"
- },
- {
- "id": 47,
- "serial": 303,
- "course_code": "CSC303",
- "year": 2012,
- "term": "fall",
- "type": "final",
- "instructors": [
- "Powell Lawson",
- "Bowman Reynolds"
- ],
- "page_count": 19,
- "questions_count": 19,
- "uploaded_by": "admin0"
- },
- {
- "id": 48,
- "serial": 323,
- "course_code": "CSC323",
- "year": 2015,
- "term": "winter",
- "type": "midterm",
- "instructors": [
- "Pacheco Gardner",
- "Nixon Summers"
- ],
- "page_count": 15,
- "questions_count": 15,
- "uploaded_by": "admin0"
- },
- {
- "id": 49,
- "serial": 322,
- "course_code": "CSC322",
- "year": 2013,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Celia Hodge",
- "Deborah Mcgee"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"
- },
- {
- "id": 50,
- "serial": 311,
- "course_code": "CSC311",
- "year": 2013,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Edna Conrad",
- "Nadia Dejesus"
- ],
- "page_count": 11,
- "questions_count": 11,
- "uploaded_by": "admin0"
- }
-] \ No newline at end of file
diff --git a/test/dbTests/resulst.txt b/test/dbTests/resulst.txt
deleted file mode 100644
index e66b964..0000000
--- a/test/dbTests/resulst.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-*****************AFTER***************************************************
-
-Wed Jul 27 10:46:50.430 [initandlisten] connection accepted from 127.0.0.1:44615 #12 (1 connection now open)
-Wed Jul 27 10:46:50.464 [initandlisten] connection accepted from 127.0.0.1:44616 #13 (2 connections now open)
-Wed Jul 27 10:46:50.468 [initandlisten] connection accepted from 127.0.0.1:44617 #14 (3 connections now open)
-Wed Jul 27 10:46:50.471 [initandlisten] connection accepted from 127.0.0.1:44618 #15 (4 connections now open)
-Wed Jul 27 10:46:50.477 [initandlisten] connection accepted from 127.0.0.1:44619 #16 (5 connections now open)
-Wed Jul 27 10:46:50.522 [conn14] build index db.users { _id: 1 }
-Wed Jul 27 10:46:50.523 [conn14] build index done. scanned 0 total records. 0 secs
-Wed Jul 27 10:46:50.539 [conn15] build index db.logins { _id: 1 }
-Wed Jul 27 10:46:50.539 [conn15] build index done. scanned 0 total records. 0 secs
-
-
-
-
-
-
diff --git a/test/dbTests/test_main.js b/test/dbTests/test_main.js
deleted file mode 100644
index fcdf74b..0000000
--- a/test/dbTests/test_main.js
+++ /dev/null
@@ -1,143 +0,0 @@
-var users_data = require('./users_data.json');
-var exams_data = require('./exams_data.json');
-
-var dbFile = require("../node_simple"); // after modifications
-// var dbFile = require("../node_simple_backup"); // original file
-
-var users_fields = format_users();
-var exams_info = format_exams();
-
-//console.log(exams_info);
-// populate_users(users_fields);
-
-dbFile.setupDB(function (success, mssg) {
- // begin
- console.log(mssg);
-
- populate_users(users_fields);
- // add_same_user(users_fields, 0);
- // remove_all_users(users_fields);
- // populate_exams(exams_info);
-
-});
-
-function populate_exams(exam_info) {
- for (var i = 0; i < exam_info[0].length; i++) {
- dbFile.add_exam(exam_info[0][i],exam_info[1][i], function (success, mssg) {
- console.log(mssg);
- })
- }
-}
-
-
-function populate_users(users_fields) {
- for (var i = 0; i < users_fields.length; i++) {
- dbFile.add_user(users_fields[i], function (success, fail, mssg) {
- if (success && !fail) {
- console.log(mssg);
- }
- })
- }
-}
-
-function add_same_user(users_fields, index) {
- var rand_user_fields = users_fields[index];
- dbFile.add_user(rand_user_fields, function (success, fail, mssg) {
- if (!success && !fail) {
- console.log(mssg);
- }
- });
-}
-
-function remove_all_users(users_fields) {
- for (var i = 0; i < users_fields.length; i++) {
- dbFile.remove_user(users_fields[i][1], function (success, mssg) {
- console.log(mssg);
- });
- // console.log(users_fields[i][1]);
- }
-}
-
-
-
-// console.log(users_fields);
-// format users to proper form
-function format_users() {
- var users_fields = [];
- users_data.forEach(function (user) {
- var fields = [];
- fields.push(user.email);
- fields.push(user.user_name);
- fields.push(user.name.first);
- fields.push(user.name.last);
- fields.push("u of t"); //university
- fields.push("CS"); // departmnet
- fields.push(user.password);
- fields.push(user.phone);
-
- // console.log(fields);
- users_fields.push(fields);
- });
-
- return users_fields;
-}
-
-function format_exams() {
- var exams_fields = [];
- var questions_arrays = [];
-
- exams_data.forEach(function (exam) {
- var fields = [];
- var question_array = [];
- fields.push(exam.course_code);
- fields.push(exam.year);
- fields.push(exam.term);
- fields.push(exam.type);
- fields.push(exam.instructors);
- fields.push(exam.page_count);
- fields.push(exam.questions_count);
- fields.push(new Date().toString());
- fields.push(exam.uploaded_by);
-
- // create questions array
- for (var j = 1; j <= exam.questions_count; j++) {
- var question = "this is question " + j;
- question_array.push(question);
- }
- /* var Data =
- {
- course_code: fields[0],
- year: fields[1],
- term: fields[2],
- type: fields[3],
- instructors: fields[4],
- page_count: fields[5],
- questions_count: fields[6],
- questions_list: [],
- upload_date: fields[7],
- uploaded_by: fields[8]
- };*/
-
- /* "id": 1,
- "serial": 321,
- "course_code": "CSC321",
- "year": 2014,
- "term": "winter",
- "type": "final",
- "instructors": [
- "Sandra Crane",
- "Mcintyre Holmes"
- ],
- "page_count": 17,
- "questions_count": 17,
- "uploaded_by": "admin0"*/
- exams_fields.push(fields);
- questions_arrays.push(question_array);
- });
-
- return [exams_fields, questions_arrays];
-}
-//var uri = 'mongodb://localhost:27017/db';
-
-
-// console.log(courses_data); \ No newline at end of file
diff --git a/test/dbTests/testingDocs.txt b/test/dbTests/testingDocs.txt
deleted file mode 100644
index cb1290b..0000000
--- a/test/dbTests/testingDocs.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-CREDIT TO:
-http://www.json-generator.com/
-
-***************************************
-User template:
-
-[
- {
- 'repeat(50, 50)': {
- serial: '{{index(1)}}',
- name: {
- first: '{{firstName()}}',
- last: '{{surname()}}'
- },
- user_name: function () {
- return ('username' + this.serial);
- },
- password: '{{objectId()}}',
- phone: '+1 {{phone()}}',
- email: function () {
- // Email tag is deprecated, because now you can produce an email as simple as this:
- return (this.name.first + '.' + this.name.last + '@' + this.name.first + this.name.last + '.com');
- }
- }
- }
-]
-
-***************************************
-Exam template:
-
-[
- {
- 'repeat(50, 50)': {
- id: '{{index(1)}}'
- serial: '{{integer(300, 325)}}',
- course_code: function () {
- return ('CSC' + this.serial);
- },
- year: '{{integer(2012,2016)}}',
- term: '{{random("fall", "winter", "summer")}}',
- type: '{{random("final", "midterm")}}',
- instructors: ['{{firstName()}} {{surname()}}',
- '{{firstName()}} {{surname()}}'],
- page_count: '{{integer(10,20)}}',
- questions_count: function () {
- return (this.page_count);
- },
- uploaded_by: 'admin0'
- }
- }
-]
-
-************************************* \ No newline at end of file
diff --git a/test/dbTests/users_data.json b/test/dbTests/users_data.json
deleted file mode 100644
index f10877c..0000000
--- a/test/dbTests/users_data.json
+++ /dev/null
@@ -1,552 +0,0 @@
-[
- {
- "serial": 1,
- "name": {
- "first": "Black",
- "last": "Bright"
- },
- "user_name": "username1",
- "password": "5796e6207e1876f616501078",
- "phone": "+1 (945) 572-3210",
- "email": "Black.Bright@BlackBright.com"
- },
- {
- "serial": 2,
- "name": {
- "first": "Nadia",
- "last": "Berger"
- },
- "user_name": "username2",
- "password": "5796e620a18475f7fda4823a",
- "phone": "+1 (889) 439-2094",
- "email": "Nadia.Berger@NadiaBerger.com"
- },
- {
- "serial": 3,
- "name": {
- "first": "Melton",
- "last": "Cline"
- },
- "user_name": "username3",
- "password": "5796e620327aaf92e83d0d73",
- "phone": "+1 (900) 590-3646",
- "email": "Melton.Cline@MeltonCline.com"
- },
- {
- "serial": 4,
- "name": {
- "first": "Frankie",
- "last": "Marks"
- },
- "user_name": "username4",
- "password": "5796e62045e75577a3d7e3c3",
- "phone": "+1 (860) 504-2203",
- "email": "Frankie.Marks@FrankieMarks.com"
- },
- {
- "serial": 5,
- "name": {
- "first": "Mandy",
- "last": "Dalton"
- },
- "user_name": "username5",
- "password": "5796e6201f3078dd03a6d285",
- "phone": "+1 (808) 501-2147",
- "email": "Mandy.Dalton@MandyDalton.com"
- },
- {
- "serial": 6,
- "name": {
- "first": "Wilder",
- "last": "Montoya"
- },
- "user_name": "username6",
- "password": "5796e62059b0a31aa76bf86b",
- "phone": "+1 (988) 464-2747",
- "email": "Wilder.Montoya@WilderMontoya.com"
- },
- {
- "serial": 7,
- "name": {
- "first": "Maribel",
- "last": "Oneal"
- },
- "user_name": "username7",
- "password": "5796e620c4db72b46721d5d7",
- "phone": "+1 (894) 588-3875",
- "email": "Maribel.Oneal@MaribelOneal.com"
- },
- {
- "serial": 8,
- "name": {
- "first": "Kristine",
- "last": "Hogan"
- },
- "user_name": "username8",
- "password": "5796e6203f519f4acde2c326",
- "phone": "+1 (941) 476-3512",
- "email": "Kristine.Hogan@KristineHogan.com"
- },
- {
- "serial": 9,
- "name": {
- "first": "Ramirez",
- "last": "Baker"
- },
- "user_name": "username9",
- "password": "5796e620f1a04ea81062a10f",
- "phone": "+1 (882) 556-2178",
- "email": "Ramirez.Baker@RamirezBaker.com"
- },
- {
- "serial": 10,
- "name": {
- "first": "Rosalyn",
- "last": "Randolph"
- },
- "user_name": "username10",
- "password": "5796e62091b246f57e15e633",
- "phone": "+1 (875) 500-3329",
- "email": "Rosalyn.Randolph@RosalynRandolph.com"
- },
- {
- "serial": 11,
- "name": {
- "first": "Patel",
- "last": "Reilly"
- },
- "user_name": "username11",
- "password": "5796e620014689a8763ac7ec",
- "phone": "+1 (827) 475-2750",
- "email": "Patel.Reilly@PatelReilly.com"
- },
- {
- "serial": 12,
- "name": {
- "first": "Lottie",
- "last": "Leach"
- },
- "user_name": "username12",
- "password": "5796e6203f4aa2de3335b378",
- "phone": "+1 (915) 513-3771",
- "email": "Lottie.Leach@LottieLeach.com"
- },
- {
- "serial": 13,
- "name": {
- "first": "Vasquez",
- "last": "Taylor"
- },
- "user_name": "username13",
- "password": "5796e6207d2f78212a1da92a",
- "phone": "+1 (985) 456-2579",
- "email": "Vasquez.Taylor@VasquezTaylor.com"
- },
- {
- "serial": 14,
- "name": {
- "first": "Jordan",
- "last": "Hernandez"
- },
- "user_name": "username14",
- "password": "5796e62055283783d46361c1",
- "phone": "+1 (869) 405-2683",
- "email": "Jordan.Hernandez@JordanHernandez.com"
- },
- {
- "serial": 15,
- "name": {
- "first": "Arlene",
- "last": "Ratliff"
- },
- "user_name": "username15",
- "password": "5796e62010323094543252ab",
- "phone": "+1 (923) 539-2011",
- "email": "Arlene.Ratliff@ArleneRatliff.com"
- },
- {
- "serial": 16,
- "name": {
- "first": "Clarke",
- "last": "Shaw"
- },
- "user_name": "username16",
- "password": "5796e620323e6121d5398190",
- "phone": "+1 (910) 406-2026",
- "email": "Clarke.Shaw@ClarkeShaw.com"
- },
- {
- "serial": 17,
- "name": {
- "first": "Jessica",
- "last": "Walls"
- },
- "user_name": "username17",
- "password": "5796e620f35ca603499c9556",
- "phone": "+1 (957) 406-3416",
- "email": "Jessica.Walls@JessicaWalls.com"
- },
- {
- "serial": 18,
- "name": {
- "first": "Perry",
- "last": "Nielsen"
- },
- "user_name": "username18",
- "password": "5796e620b6ad16ea2f810c40",
- "phone": "+1 (874) 475-3537",
- "email": "Perry.Nielsen@PerryNielsen.com"
- },
- {
- "serial": 19,
- "name": {
- "first": "Mcgowan",
- "last": "Poole"
- },
- "user_name": "username19",
- "password": "5796e620908d1eb8332825c3",
- "phone": "+1 (898) 403-2705",
- "email": "Mcgowan.Poole@McgowanPoole.com"
- },
- {
- "serial": 20,
- "name": {
- "first": "Irma",
- "last": "Barry"
- },
- "user_name": "username20",
- "password": "5796e620604a7ce665ccd7b1",
- "phone": "+1 (909) 455-3427",
- "email": "Irma.Barry@IrmaBarry.com"
- },
- {
- "serial": 21,
- "name": {
- "first": "Deena",
- "last": "Mccall"
- },
- "user_name": "username21",
- "password": "5796e620a5f226931125509f",
- "phone": "+1 (907) 490-2811",
- "email": "Deena.Mccall@DeenaMccall.com"
- },
- {
- "serial": 22,
- "name": {
- "first": "Janette",
- "last": "Norton"
- },
- "user_name": "username22",
- "password": "5796e62047ca93f8a0710ff8",
- "phone": "+1 (829) 415-3092",
- "email": "Janette.Norton@JanetteNorton.com"
- },
- {
- "serial": 23,
- "name": {
- "first": "Lesley",
- "last": "Maxwell"
- },
- "user_name": "username23",
- "password": "5796e620ba14f1cf1eeadd29",
- "phone": "+1 (938) 450-3230",
- "email": "Lesley.Maxwell@LesleyMaxwell.com"
- },
- {
- "serial": 24,
- "name": {
- "first": "Celia",
- "last": "Dennis"
- },
- "user_name": "username24",
- "password": "5796e6202d1bc5c661d489bf",
- "phone": "+1 (803) 422-2956",
- "email": "Celia.Dennis@CeliaDennis.com"
- },
- {
- "serial": 25,
- "name": {
- "first": "Dale",
- "last": "Bradford"
- },
- "user_name": "username25",
- "password": "5796e620d2792f71e06313dd",
- "phone": "+1 (950) 506-2099",
- "email": "Dale.Bradford@DaleBradford.com"
- },
- {
- "serial": 26,
- "name": {
- "first": "Maxwell",
- "last": "Fields"
- },
- "user_name": "username26",
- "password": "5796e6207bfe453df2ce45ee",
- "phone": "+1 (829) 578-3119",
- "email": "Maxwell.Fields@MaxwellFields.com"
- },
- {
- "serial": 27,
- "name": {
- "first": "Wilson",
- "last": "Hodges"
- },
- "user_name": "username27",
- "password": "5796e620f3e12dcde26694ba",
- "phone": "+1 (881) 505-3111",
- "email": "Wilson.Hodges@WilsonHodges.com"
- },
- {
- "serial": 28,
- "name": {
- "first": "Slater",
- "last": "Wood"
- },
- "user_name": "username28",
- "password": "5796e6204f929a497bf3eb3c",
- "phone": "+1 (836) 409-3926",
- "email": "Slater.Wood@SlaterWood.com"
- },
- {
- "serial": 29,
- "name": {
- "first": "Mercedes",
- "last": "Daniel"
- },
- "user_name": "username29",
- "password": "5796e6201c17ca184ae56403",
- "phone": "+1 (974) 492-2952",
- "email": "Mercedes.Daniel@MercedesDaniel.com"
- },
- {
- "serial": 30,
- "name": {
- "first": "Morrison",
- "last": "Chase"
- },
- "user_name": "username30",
- "password": "5796e620f69f3bad92b18a62",
- "phone": "+1 (843) 502-3078",
- "email": "Morrison.Chase@MorrisonChase.com"
- },
- {
- "serial": 31,
- "name": {
- "first": "Nguyen",
- "last": "Combs"
- },
- "user_name": "username31",
- "password": "5796e620c374db38f2466c0f",
- "phone": "+1 (936) 565-2670",
- "email": "Nguyen.Combs@NguyenCombs.com"
- },
- {
- "serial": 32,
- "name": {
- "first": "Conrad",
- "last": "Houston"
- },
- "user_name": "username32",
- "password": "5796e6209065433baf4beff0",
- "phone": "+1 (870) 545-3867",
- "email": "Conrad.Houston@ConradHouston.com"
- },
- {
- "serial": 33,
- "name": {
- "first": "Darlene",
- "last": "Stone"
- },
- "user_name": "username33",
- "password": "5796e62068386ba4196b83ac",
- "phone": "+1 (942) 411-2445",
- "email": "Darlene.Stone@DarleneStone.com"
- },
- {
- "serial": 34,
- "name": {
- "first": "Wallace",
- "last": "Barlow"
- },
- "user_name": "username34",
- "password": "5796e620105213003d0faa7f",
- "phone": "+1 (980) 526-3375",
- "email": "Wallace.Barlow@WallaceBarlow.com"
- },
- {
- "serial": 35,
- "name": {
- "first": "Vance",
- "last": "Pena"
- },
- "user_name": "username35",
- "password": "5796e620e13fb58c441ca9cc",
- "phone": "+1 (908) 460-3824",
- "email": "Vance.Pena@VancePena.com"
- },
- {
- "serial": 36,
- "name": {
- "first": "Mathis",
- "last": "Guerra"
- },
- "user_name": "username36",
- "password": "5796e620d9551f3ac2b1b0e1",
- "phone": "+1 (993) 476-3716",
- "email": "Mathis.Guerra@MathisGuerra.com"
- },
- {
- "serial": 37,
- "name": {
- "first": "Reyes",
- "last": "Prince"
- },
- "user_name": "username37",
- "password": "5796e620a65c244f4ad441d4",
- "phone": "+1 (842) 409-2138",
- "email": "Reyes.Prince@ReyesPrince.com"
- },
- {
- "serial": 38,
- "name": {
- "first": "Lidia",
- "last": "Davidson"
- },
- "user_name": "username38",
- "password": "5796e6209e9d31b40b56d7db",
- "phone": "+1 (974) 570-2558",
- "email": "Lidia.Davidson@LidiaDavidson.com"
- },
- {
- "serial": 39,
- "name": {
- "first": "Burt",
- "last": "Bowers"
- },
- "user_name": "username39",
- "password": "5796e620e2abe7fb16d4fc9f",
- "phone": "+1 (809) 531-3676",
- "email": "Burt.Bowers@BurtBowers.com"
- },
- {
- "serial": 40,
- "name": {
- "first": "Martha",
- "last": "Holcomb"
- },
- "user_name": "username40",
- "password": "5796e620506465b62c83377f",
- "phone": "+1 (946) 538-2534",
- "email": "Martha.Holcomb@MarthaHolcomb.com"
- },
- {
- "serial": 41,
- "name": {
- "first": "Erica",
- "last": "Mcclure"
- },
- "user_name": "username41",
- "password": "5796e620b8b8bde026ff61a8",
- "phone": "+1 (939) 518-3893",
- "email": "Erica.Mcclure@EricaMcclure.com"
- },
- {
- "serial": 42,
- "name": {
- "first": "Dolly",
- "last": "Webster"
- },
- "user_name": "username42",
- "password": "5796e620e817213493ad2235",
- "phone": "+1 (838) 451-2740",
- "email": "Dolly.Webster@DollyWebster.com"
- },
- {
- "serial": 43,
- "name": {
- "first": "Valarie",
- "last": "Douglas"
- },
- "user_name": "username43",
- "password": "5796e6201e224c3aa524244e",
- "phone": "+1 (845) 532-2587",
- "email": "Valarie.Douglas@ValarieDouglas.com"
- },
- {
- "serial": 44,
- "name": {
- "first": "Hendricks",
- "last": "Griffin"
- },
- "user_name": "username44",
- "password": "5796e62010f6b8ea19622369",
- "phone": "+1 (874) 541-3472",
- "email": "Hendricks.Griffin@HendricksGriffin.com"
- },
- {
- "serial": 45,
- "name": {
- "first": "Shawn",
- "last": "Villarreal"
- },
- "user_name": "username45",
- "password": "5796e620988721b6d671ffea",
- "phone": "+1 (899) 436-2843",
- "email": "Shawn.Villarreal@ShawnVillarreal.com"
- },
- {
- "serial": 46,
- "name": {
- "first": "Bonner",
- "last": "Mullins"
- },
- "user_name": "username46",
- "password": "5796e620318f59bf26d77201",
- "phone": "+1 (962) 428-3483",
- "email": "Bonner.Mullins@BonnerMullins.com"
- },
- {
- "serial": 47,
- "name": {
- "first": "Yvonne",
- "last": "Witt"
- },
- "user_name": "username47",
- "password": "5796e6208584f7d4dcac86fe",
- "phone": "+1 (982) 534-2609",
- "email": "Yvonne.Witt@YvonneWitt.com"
- },
- {
- "serial": 48,
- "name": {
- "first": "Clarissa",
- "last": "Wilkins"
- },
- "user_name": "username48",
- "password": "5796e6208a401d701bf2cfa6",
- "phone": "+1 (971) 510-3367",
- "email": "Clarissa.Wilkins@ClarissaWilkins.com"
- },
- {
- "serial": 49,
- "name": {
- "first": "Tillman",
- "last": "Adams"
- },
- "user_name": "username49",
- "password": "5796e620547de14f35381727",
- "phone": "+1 (937) 575-3434",
- "email": "Tillman.Adams@TillmanAdams.com"
- },
- {
- "serial": 50,
- "name": {
- "first": "Alisha",
- "last": "Farrell"
- },
- "user_name": "username50",
- "password": "5796e6200f5ec8dc32edfa21",
- "phone": "+1 (974) 454-3592",
- "email": "Alisha.Farrell@AlishaFarrell.com"
- }
-] \ No newline at end of file
diff --git a/test/routingDb_tests.js b/test/routingDb_tests.js
index d3a607f..b700f4c 100644
--- a/test/routingDb_tests.js
+++ b/test/routingDb_tests.js
@@ -1,5 +1,6 @@
var chai = require('chai');
var chaiHttp = require('chai-http');
+var dbFile = require('../node_simple');
var expect = require('chai').expect;
var assert = chai.assert;
var url = require("url");
@@ -41,6 +42,18 @@ var users = (JSON.parse(usersPull));
chai.use(chaiHttp);
+
+
+/* Set up DB connection as it is required for the test cases below*/
+dbFile.setupDB(function (success, mssg) {
+ if(success){
+ console.log('Db Connection success');
+ } else{
+ console.log('Failed to connect');
+ }
+});
+
+
/* Test simple routes that do not require database queries */
describe('Test Basic Route:', function () {
@@ -112,9 +125,11 @@ describe('Test Basic Route:', function () {
/* Public profile page response test */
describe('User profile page (public) Route:', function(){
var server;
- before(function () {
+ before(function (done) {
server = require('./test_server');
+ done();
});
+
after(function () {
server.close();
});
@@ -125,7 +140,6 @@ describe('User profile page (public) Route:', function(){
.get('/public_profile/' + username)
.end(function(err, res){
expect(res).to.have.status(200);
-
var path = res.res.req.path;
assert.equal(path, '/public_profile/' + username); // Check url path
done();
@@ -293,11 +307,11 @@ describe('Questions Search Route:', function(){
chai.request(server)
.get('/questions/batman')
.end(function(err, res){
- expect(res).to.have.status(200);
+ expect(res).to.have.status(500);
var path = res.res.req.path;
// Redirected to homepage (with err msg)
- assert.equal(path, '/');
+ assert.equal(path, '/questions/batman');
done();
});
});
diff --git a/test/test_server.js b/test/test_server.js
index 9514124..a492f2d 100644
--- a/test/test_server.js
+++ b/test/test_server.js
@@ -10,4 +10,6 @@ server.listen(port, function(){
console.log('Listening on port 3000..');
});
+
+
module.exports = server; \ No newline at end of file