Last active
August 29, 2015 14:16
-
-
Save simong/c4bb160ce276ed78f3db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * Test that verifies that leaving a group removes it from the membership library | |
| */ | |
| it('verify leaving a group removes it from the membership library', function(callback) { | |
| TestsUtil.generateTestUsers(camAdminRestContext, 2, function(err, users, simon, nico) { | |
| assert.ok(!err); | |
| // Simon generates a test group that anyone can join | |
| TestsUtil.generateTestGroups(simon.restContext, 1, function(group) { | |
| // Nico joins the group | |
| RestAPI.Group.joinGroup(nico.restContext, group.group.id, function(err) { | |
| assert.ok(!err); | |
| // The group should be in the membership library | |
| RestAPI.Group.getMembershipsLibrary(nico.restContext, nico.user.id, null, null, function(err, memberships) { | |
| assert.ok(!err); | |
| assert.strictEqual(memberships.results.length, 1); | |
| assert.strictEqual(memberships.results[0].id, group.group.id); | |
| // Nico leaves the group | |
| RestAPI.Group.leaveGroup(nico.restContext, group.group.id, function(err) { | |
| assert.ok(!err); | |
| // The group should no longer be in the membership library | |
| RestAPI.Group.getMembershipsLibrary(nico.restContext, nico.user.id, null, null, function(err, memberships) { | |
| assert.ok(!err); | |
| assert.strictEqual(memberships.results.length, 0); | |
| return callback(); | |
| }); | |
| }); | |
| }); | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment