4 more to go
parent
253d6da2ac
commit
198e211671
|
@ -12,6 +12,7 @@ var testPadId = makeid();
|
||||||
var groupID = "";
|
var groupID = "";
|
||||||
var authorID = "";
|
var authorID = "";
|
||||||
var sessionID = "";
|
var sessionID = "";
|
||||||
|
var padID = makeid();
|
||||||
|
|
||||||
describe('API Versioning', function(){
|
describe('API Versioning', function(){
|
||||||
it('errors if can not connect', function(done) {
|
it('errors if can not connect', function(done) {
|
||||||
|
@ -51,9 +52,10 @@ describe('API Versioning', function(){
|
||||||
-> listPads(groupID) -- should be empty array
|
-> listPads(groupID) -- should be empty array
|
||||||
-> getPublicStatus(padId)
|
-> getPublicStatus(padId)
|
||||||
-> setPublicStatus(padId, status)
|
-> setPublicStatus(padId, status)
|
||||||
-> isPasswordProtected(padID) -- should be false
|
-> getPublicStatus(padId)
|
||||||
-> setPassword(padID, password)
|
-> isPasswordProtected(padID) -- should be false
|
||||||
-> isPasswordProtected(padID) -- should be true
|
-> setPassword(padID, password)
|
||||||
|
-> isPasswordProtected(padID) -- should be true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
describe('createGroup', function(){
|
describe('createGroup', function(){
|
||||||
|
@ -95,7 +97,18 @@ describe('createGroupIfNotExistsFor', function(){
|
||||||
api.get(endPoint('createGroupIfNotExistsFor')+"&groupMapper=management")
|
api.get(endPoint('createGroupIfNotExistsFor')+"&groupMapper=management")
|
||||||
.expect(function(res){
|
.expect(function(res){
|
||||||
if(res.body.code !== 0 || !res.body.data.groupID) throw new Error("Sessions show as existing for this group");
|
if(res.body.code !== 0 || !res.body.data.groupID) throw new Error("Sessions show as existing for this group");
|
||||||
groupID = res.body.data.groupID
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('createGroup', function(){
|
||||||
|
it('creates a new group', function(done) {
|
||||||
|
api.get(endPoint('createGroup'))
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0 || !res.body.data.groupID) throw new Error("Unable to create new Pad");
|
||||||
|
groupID = res.body.data.groupID;
|
||||||
})
|
})
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect(200, done)
|
.expect(200, done)
|
||||||
|
@ -207,17 +220,80 @@ describe('getSessionInfo', function(){
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Endpoints Still to interact with..
|
describe('listPads', function(){
|
||||||
-> listPads(groupID) -- should be empty array
|
it('Lists Pads of a Group', function(done) {
|
||||||
-> createGroupPad(groupID, padName [, text])
|
api.get(endPoint('listPads')+"&groupID="+groupID)
|
||||||
-> listPads(groupID) -- should be empty array
|
.expect(function(res){
|
||||||
-> getPublicStatus(padId)
|
console.log(res.body.data.padIDs);
|
||||||
-> setPublicStatus(padId, status)
|
if(res.body.code !== 0 || res.body.data.padIDs.length !== 0) throw new Error("Group already had pads for some reason"+res.body.data.padIDs);
|
||||||
-> isPasswordProtected(padID) -- should be false
|
})
|
||||||
-> setPassword(padID, password)
|
.expect('Content-Type', /json/)
|
||||||
-> isPasswordProtected(padID) -- should be true
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
-> listPadsOfAuthor(authorID)
|
describe('createGroupPad', function(){
|
||||||
|
it('Creates a Group Pad', function(done) {
|
||||||
|
api.get(endPoint('createGroupPad')+"&groupID="+groupID+"&padName="+padID)
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0) throw new Error("Unable to create group pad");
|
||||||
|
padID = res.body.data.padID;
|
||||||
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('listPads', function(){
|
||||||
|
it('Lists Pads of a Group', function(done) {
|
||||||
|
api.get(endPoint('listPads')+"&groupID="+groupID)
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0 || res.body.data.padIDs.length !== 1) throw new Error("Group isnt listing this pad");
|
||||||
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('getPublicStatus', function(){
|
||||||
|
it('Gets the public status of a pad', function(done) {
|
||||||
|
api.get(endPoint('getPublicStatus')+"&padID="+padID)
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0 || res.body.data.publicstatus) throw new Error("Unable to get public status of this pad");
|
||||||
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('setPublicStatus', function(){
|
||||||
|
it('Sets the public status of a pad', function(done) {
|
||||||
|
api.get(endPoint('setPublicStatus')+"&padID="+padID+"&publicStatus=true")
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0) throw new Error("Setting status did not work");
|
||||||
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('getPublicStatus', function(){
|
||||||
|
it('Gets the public status of a pad', function(done) {
|
||||||
|
api.get(endPoint('getPublicStatus')+"&padID="+padID)
|
||||||
|
.expect(function(res){
|
||||||
|
if(res.body.code !== 0 || !res.body.data.publicStatus) throw new Error("Setting public status of this pad did not work");
|
||||||
|
})
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200, done)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/* Endpoints Still to interact with..
|
||||||
|
-> isPasswordProtected(padID) -- should be false
|
||||||
|
-> setPassword(padID, password)
|
||||||
|
-> isPasswordProtected(padID) -- should be true
|
||||||
|
-> listPadsOfAuthor(authorID)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue