summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/backendTests.sh2
-rw-r--r--tests/backend/specs/api/pad.js (renamed from tests/backend/specs/api.js)42
-rw-r--r--tests/backend/specs/api/sessionsAndGroups.js38
3 files changed, 40 insertions, 42 deletions
diff --git a/bin/backendTests.sh b/bin/backendTests.sh
index ab07e012..ec12775b 100755
--- a/bin/backendTests.sh
+++ b/bin/backendTests.sh
@@ -1 +1 @@
-src/node_modules/mocha/bin/mocha --timeout 5000 --reporter nyan tests/backend/specs
+src/node_modules/mocha/bin/mocha --timeout 5000 --reporter nyan tests/backend/specs/api
diff --git a/tests/backend/specs/api.js b/tests/backend/specs/api/pad.js
index 279f3088..efb3f6de 100644
--- a/tests/backend/specs/api.js
+++ b/tests/backend/specs/api/pad.js
@@ -4,7 +4,7 @@ var assert = require('assert')
api = supertest('http://localhost:9001');
path = require('path');
-var filePath = path.join(__dirname, '../../../APIKEY.txt');
+var filePath = path.join(__dirname, '../../../../APIKEY.txt');
var apiKey = fs.readFileSync(filePath, {encoding: 'utf-8'});
var apiVersion = 1;
@@ -197,46 +197,6 @@ describe('getReadOnlyID', function(){
});
})
-
-
-/* Endpoints Still to interact with..
-padUsersCount(padID)
-setPublicStatus(padID, publicStatus)
-getPublicStatus(padID)
-setPassword(padID, password)
-isPasswordProtected(padID)
-listAuthorsOfPad(padID)
-getLastEdited(padID)
-listSessionsOfGroup(groupID)
-getSessionInfo(sessionID)
-deleteSession(sessionID)
-createSession(groupID, authorID, validUntil)
-listPadsOfAuthor(authorID)
-createAuthorIfNotExistsFor(authorMapper [, name])
-createAuthor([name])
-createGroupPad(groupID, padName [, text])
-listPads(groupID)
-deleteGroup(groupID)
-createGroupIfNotExistsFor(groupMapper)
-createGroup()
-*/
-
-
-/*
-describe('getRevisionsCount', function(){
- it('gets the revision counts of a new pad', function(done) {
- // This is broken because Etherpad doesn't handle HTTP codes properly see #2$
- // If your APIKey is password you deserve to fail all tests anyway
- api.get(endPoint('getRevisionsCount')+"&padID="+testPadId)
- .expect('Content-Type', /json/)
- .expect(function(res){
- console.log(res.body);
- })
- .expect(200, done)
- });
-})
-*/
-
var endPoint = function(point){
return '/api/'+apiVersion+'/'+point+'?apikey='+apiKey;
}
diff --git a/tests/backend/specs/api/sessionsAndGroups.js b/tests/backend/specs/api/sessionsAndGroups.js
new file mode 100644
index 00000000..921724c7
--- /dev/null
+++ b/tests/backend/specs/api/sessionsAndGroups.js
@@ -0,0 +1,38 @@
+/* Endpoints Still to interact with..
+padUsersCount(padID)
+setPublicStatus(padID, publicStatus)
+getPublicStatus(padID)
+setPassword(padID, password)
+isPasswordProtected(padID)
+listAuthorsOfPad(padID)
+getLastEdited(padID)
+listSessionsOfGroup(groupID)
+getSessionInfo(sessionID)
+deleteSession(sessionID)
+createSession(groupID, authorID, validUntil)
+listPadsOfAuthor(authorID)
+createAuthorIfNotExistsFor(authorMapper [, name])
+createAuthor([name])
+createGroupPad(groupID, padName [, text])
+listPads(groupID)
+deleteGroup(groupID)
+createGroupIfNotExistsFor(groupMapper)
+createGroup()
+*/
+
+
+var endPoint = function(point){
+ return '/api/'+apiVersion+'/'+point+'?apikey='+apiKey;
+}
+
+function makeid()
+{
+ var text = "";
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ for( var i=0; i < 5; i++ ){
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
+ }
+ return text;
+}
+