-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
598 additions
and
333 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
test_new_structure/routes/user/avatar/routes.user.avatar.Test.js.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var chai = require("chai"); | ||
var chaiHttp = require("chai-http"); | ||
const should = chai.should(); | ||
var _ = require("underscore"); | ||
chai.use(chaiHttp); | ||
|
||
const Config = GLOBAL.Config; | ||
|
||
const userUtils = require(Config.absPathInTestsFolder("utils/user/userUtils.js")); | ||
|
||
const appUtils = require(Config.absPathInTestsFolder("utils/app/appUtils.js")); | ||
var createUserUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createUsers.Unit.js")); | ||
//TODO var createAvatarsForUsersUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createAvatarsForUsers.Unit.js")); | ||
|
||
describe("[GET] /user/avatar", function (done) { | ||
|
||
before(function (done) { | ||
this.timeout(60000); | ||
createUserUnit.setup(function (err, results) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("[JSON] should give an unauthorized error if the current user is not authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give a not found error if the avatar is from a user that does not exist and if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give an unauthorized error if the avatar is from a user that does not exist and if the current user is not authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser1 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser2 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser2 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
after(function (done) { | ||
this.timeout(60000); | ||
appUtils.clearAppState(function (err, data) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
57 changes: 57 additions & 0 deletions
57
test_new_structure/routes/user/demouser1/route.user.demouser1.avatar.Test.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var chai = require("chai"); | ||
var chaiHttp = require("chai-http"); | ||
const should = chai.should(); | ||
var _ = require("underscore"); | ||
chai.use(chaiHttp); | ||
|
||
const Config = GLOBAL.Config; | ||
|
||
const userUtils = require(Config.absPathInTestsFolder("utils/user/userUtils.js")); | ||
|
||
const appUtils = require(Config.absPathInTestsFolder("utils/app/appUtils.js")); | ||
var createUserUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createUsers.Unit.js")); | ||
//TODO var createAvatarsForUsersUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createAvatarsForUsers.Unit.js")); | ||
|
||
describe("[GET] /user/demouser1/avatar", function (done) { | ||
|
||
before(function (done) { | ||
this.timeout(60000); | ||
createUserUnit.setup(function (err, results) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("[JSON] should give an unauthorized error if the current user is not authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give a not found error if the avatar is from a user that does not exist and if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give an unauthorized error if the avatar is from a user that does not exist and if the current user is not authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser1 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser2 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
it("[JSON] should give the avatar for demouser2 if the current user is authenticated", function (done) { | ||
|
||
}); | ||
|
||
after(function (done) { | ||
this.timeout(60000); | ||
appUtils.clearAppState(function (err, data) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
125 changes: 125 additions & 0 deletions
125
test_new_structure/routes/user/demouser2/route.user.demouser2.avatar.Test.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
var chai = require("chai"); | ||
var chaiHttp = require("chai-http"); | ||
const should = chai.should(); | ||
var _ = require("underscore"); | ||
chai.use(chaiHttp); | ||
|
||
const Config = GLOBAL.Config; | ||
|
||
const userUtils = require(Config.absPathInTestsFolder("utils/user/userUtils.js")); | ||
|
||
const appUtils = require(Config.absPathInTestsFolder("utils/app/appUtils.js")); | ||
var createUserUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createUsers.Unit.js")); | ||
|
||
describe("/user/demouser1", function (done) { | ||
|
||
const demouser1 = require(Config.absPathInTestsFolder("mockdata/users/demouser1.js")); | ||
const falseUser = "demouser404"; | ||
|
||
before(function (done) { | ||
this.timeout(60000); | ||
createUserUnit.setup(function (err, results) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("[JSON] should NOT access demouser1.username profile when given demouser1.username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(demouser1.username, true, agent, function(err, res){ | ||
res.should.have.status(401); | ||
res.text.should.contain("You are not logged into the system."); | ||
done(); | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given demouser1.username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(demouser1.username, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.redirects[0].should.contain("/login"); | ||
res.text.should.contain("Please log into the system"); | ||
done(); | ||
}) | ||
}); | ||
//review agent immediatly | ||
it("[JSON] should access demouser1.username profile when given demouser1.username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(demouser1.username, true, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("\"username\":\"demouser1\""); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[HTML] should access demouser1.username profile when given demouser1.username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(demouser1.username, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("Viewing user demouser1"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
|
||
it("[JSON] should NOT access demouser1.username profile when given non-existent username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(falseUser, true, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("demouser404 does not exist"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given non-existent username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(falseUser, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("demouser404 does not exist"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[JSON] should NOT access demouser1.username profile when given non-existent username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(falseUser, true, agent, function(err, res){ | ||
res.should.have.status(401); | ||
res.text.should.contain("You are not logged into the system"); | ||
done(); | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given non-existent username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(falseUser, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("Please log into the system"); | ||
done(); | ||
}) | ||
}); | ||
|
||
after(function (done) { | ||
this.timeout(60000); | ||
appUtils.clearAppState(function (err, data) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
125 changes: 125 additions & 0 deletions
125
test_new_structure/routes/user/demouser3/route.user.demouser3.avatar.Test.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
var chai = require("chai"); | ||
var chaiHttp = require("chai-http"); | ||
const should = chai.should(); | ||
var _ = require("underscore"); | ||
chai.use(chaiHttp); | ||
|
||
const Config = GLOBAL.Config; | ||
|
||
const userUtils = require(Config.absPathInTestsFolder("utils/user/userUtils.js")); | ||
|
||
const appUtils = require(Config.absPathInTestsFolder("utils/app/appUtils.js")); | ||
var createUserUnit = appUtils.requireUncached(Config.absPathInTestsFolder("units/users/createUsers.Unit.js")); | ||
|
||
describe("/user/demouser1", function (done) { | ||
|
||
const demouser1 = require(Config.absPathInTestsFolder("mockdata/users/demouser1.js")); | ||
const falseUser = "demouser404"; | ||
|
||
before(function (done) { | ||
this.timeout(60000); | ||
createUserUnit.setup(function (err, results) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("[JSON] should NOT access demouser1.username profile when given demouser1.username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(demouser1.username, true, agent, function(err, res){ | ||
res.should.have.status(401); | ||
res.text.should.contain("You are not logged into the system."); | ||
done(); | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given demouser1.username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(demouser1.username, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.redirects[0].should.contain("/login"); | ||
res.text.should.contain("Please log into the system"); | ||
done(); | ||
}) | ||
}); | ||
//review agent immediatly | ||
it("[JSON] should access demouser1.username profile when given demouser1.username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(demouser1.username, true, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("\"username\":\"demouser1\""); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[HTML] should access demouser1.username profile when given demouser1.username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(demouser1.username, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("Viewing user demouser1"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
|
||
it("[JSON] should NOT access demouser1.username profile when given non-existent username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(falseUser, true, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("demouser404 does not exist"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given non-existent username and logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent) { | ||
userUtils.getUserInfo(falseUser, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("demouser404 does not exist"); | ||
done(); | ||
}) | ||
}) | ||
}); | ||
|
||
it("[JSON] should NOT access demouser1.username profile when given non-existent username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(falseUser, true, agent, function(err, res){ | ||
res.should.have.status(401); | ||
res.text.should.contain("You are not logged into the system"); | ||
done(); | ||
}) | ||
}); | ||
|
||
it("[HTML] should NOT access demouser1.username profile when given non-existent username and NOT logged in",function (done) { | ||
var app = GLOBAL.tests.app; | ||
var agent = chai.request.agent(app); | ||
userUtils.getUserInfo(falseUser, false, agent, function(err, res){ | ||
res.should.have.status(200); | ||
res.text.should.contain("Please log into the system"); | ||
done(); | ||
}) | ||
}); | ||
|
||
after(function (done) { | ||
this.timeout(60000); | ||
appUtils.clearAppState(function (err, data) { | ||
should.equal(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.