Skip to content
Browse files

test the operator list is up to date when a new operator is added

  • Loading branch information...
1 parent 41cf616 commit 4f3aff288b935ba4e2b11b9743c2d619afcfd2e3 @kerphi committed Jan 13, 2013
Showing with 27 additions and 2 deletions.
  1. +27 −2 server/tests/channels-op.js
View
29 server/tests/channels-op.js
@@ -136,17 +136,25 @@ vows.describe('Channel operator rights tests').addBatch({
jar: j1,
}, callback);
},
+ // [11] u2 get the operator list
+ function USER2OPLIST3(callback) {
+ request({
+ method: 'GET',
+ url: baseurl + '/server/channels/' + cid1 + '/op/',
+ jar: j2,
+ }, callback);
+ },
// `server/channels/:cid/op/:uid` - DELETE - removes operator rights to :uid on :cid channel (try to)
- // [11] u1 try to remove op rights to u2
+ // [12] u1 try to remove op rights to u2
function USER1REMOVEOP(callback) {
request({
method: 'DELETE',
url: baseurl + '/server/channels/' + cid1 + '/op/' + userdata2.id,
jar: j1,
}, callback);
},
- // [12] u2 try to remove op rights to u1
+ // [13] u2 try to remove op rights to u1
function USER2REMOVEOP(callback) {
request({
method: 'DELETE',
@@ -253,6 +261,23 @@ vows.describe('Channel operator rights tests').addBatch({
assert.equal(result.statusCode, 200, 'should returns 200 (user1 IS an operator so he can give op rights to other users)');
},
+ 'once user1 gave op rights to user2, the operator list should contain user1 and user2': function (error, results, requests, steps) {
+ var result = results[steps.USER2OPLIST3][0];
+ assert.equal(result.statusCode, 200);
+
+ var response = {};
+ try {
+ response = JSON.parse(result.body);
+ } catch (err) {
+ assert.isNull(err, 'response body should be JSON formated');
+ }
+
+ assert.isArray(response);
+ assert.lengthOf(response, 2);
+ assert.include(response, userdata1.id);
+ assert.include(response, userdata2.id);
+ },
+
'user1 should be able to remove op rights to user2': function (error, results, requests, steps) {
var result = results[steps.USER1REMOVEOP][0];
assert.equal(result.statusCode, 200, 'should returns 200 (user1 IS an operator so he can remove op rights to other users)');

0 comments on commit 4f3aff2

Please sign in to comment.
Something went wrong with that request. Please try again.