it('verify subscribing to an organisational unit is possible when already subscribed to a serie in the organisational unit', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate a test organisational unit OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test orgunit 1', 'type', null, function(orgUnit) { // Generate some test series with some events and add them to the organisational unit var calendarStart = moment().subtract(1, 'day').format(); var calendarEnd = moment().add(30, 'day').format(); SeriesTestsUtil.generateSerieWithEvents(global.tests.admins.cam2013.client, 3, 5, calendarStart, calendarEnd, function(series) { var serieIds = _.pluck(series, 'id'); OrgUnitTestsUtil.assertAddOrgUnitSeries(global.tests.admins.cam2013.client, orgUnit.id, serieIds, function() { // Subscribe to the first serie SeriesTestsUtil.assertSubscribeSeries(simon.client, series[0].id, simon.profile.id, orgUnit.id, function() { // Subscribe to the organisational unit OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, orgUnit.id, null, function() { // Verify the user calendar contains the events of all 3 series var allEvents = _.union(series[0].events, series[1].events, series[2].events); UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, allEvents, function(calendar) { assert.strictEqual(calendar.results.length, 15); return callback(); }); }); }); }); }); }); }); });
it('verify validation when a user subscribes to an organisational unit', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate a test organisational unit OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test orgunit', 'test', null, function(orgUnit) { // Invalid organisational unit id OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, 'Not a number', simon.profile.id, 400, function() { // Unknown organisational unit id OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, -1, simon.profile.id, 404, function() { OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, 234234234234, simon.profile.id, 404, function() { // Invalid user id OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, orgUnit.id, 'Not a number', 400, function() { // Unknown user id OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, orgUnit.id, -1, 404, function() { OrgUnitTestsUtil.assertSubscribeOrgUnitFails(simon.client, orgUnit.id, 234242423423, 404, function() { return callback(); }); }); }); }); }); }); }); }); });
it('verify subscribing to an organisational unit with borrowed series does not duplicate events in the user calendar', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate two test organisational units OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test orgunit 1', 'type', null, function(orgUnit1) { OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test orgunit 2', 'type', null, function(orgUnit2) { // Generate a test serie with some events and add it to both organisational units var calendarStart = moment().subtract(1, 'day').format(); var calendarEnd = moment().add(30, 'day').format(); SeriesTestsUtil.generateSerieWithEvents(global.tests.admins.cam2013.client, 1, 5, calendarStart, calendarEnd, function(series) { var serie = series[0]; OrgUnitTestsUtil.assertAddOrgUnitSeries(global.tests.admins.cam2013.client, orgUnit1.id, [serie.id], function() { OrgUnitTestsUtil.assertAddOrgUnitSeries(global.tests.admins.cam2013.client, orgUnit2.id, [serie.id], function() { // Subscribe to both organisational units OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, orgUnit1.id, null, function() { OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, orgUnit2.id, null, function() { // Verify only 5 unique events are in the user's calendar UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, serie.events, function(calendar) { assert.strictEqual(calendar.results.length, 5); return callback(); }); }); }); }); }); }); }); }); }); });
it('verify organisers their personal information is hidden', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 3, false, function(simon, nico, sam) { var start = moment().format(); var end = moment().add(2, 'hour').format(); // Create an event EventsTestsUtil.assertCreateEvent(simon.client, 'Test event', start, end, null, function(event) { // Add Nico as an organiser var update = {}; update[nico.profile.id] = true; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Get the event EventsTestsUtil.assertGetEvent(simon.client, event.id, null, function(event) { assert.strictEqual(event.organisers.length, 2); var organisersById = _.indexBy(event.organisers, 'id'); // Verify Nico's information is hidden UsersTestsUtil.assertUser(organisersById[nico.profile.id], {'expectedUser': nico.profile, 'canViewPrivateFields': false}); // Simon his own personal info should be displayed UsersTestsUtil.assertUser(organisersById[simon.profile.id], {'expectedUser': simon.profile, 'canViewPrivateFields': true}); return callback(); }); }); }); }); });
OrgUnitTestsUtil.assertExportOrgUnitFails(anonymousGlobalClient, part.id, null, 401, function() { // Regular users from another application can't export an organisational unit TestsUtil.generateTestUsers(global.tests.apps.oxford2014, 1, false, function(simon) { OrgUnitTestsUtil.assertExportOrgUnitFails(simon.client, part.id, null, 401, function() { // Application administrators from another application can't export an organisational unit OrgUnitTestsUtil.assertExportOrgUnitFails(global.tests.admins.oxford2014.client, part.id, null, 401, function() { // Regular users from the same application can export an organisational unit TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(nico) { OrgUnitTestsUtil.assertExportOrgUnitFails(nico.client, part.id, null, 401, function() { // Application administrators from the same application can export an organisational unit OrgUnitTestsUtil.assertExportOrgUnit(global.tests.admins.cam2013.client, part.id, null, function(data) { // Global administrators can export an organisational unit TestsUtil.getGlobalAdminRestClient(function(globalAdminRestClient) { OrgUnitTestsUtil.assertExportOrgUnit(globalAdminRestClient, part.id, null, function(data) { return callback(); }); }); }); }); }); }); }); }); });
it('verify unsubscribing from an organisational unit can handle unsubscribed series', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate two organisational unit structures that each hold some series OrgUnitTestsUtil.createSimpleTree(global.tests.admins.cam2013.client, function(courseUnit, subjectUnit, partUnit, moduleUnit, series) { // Subscribe to one serie, but NOT the organisational unit SeriesTestsUtil.assertSubscribeSeries(simon.client, series[0].id, simon.profile.id, moduleUnit.id, function() { // Unsubscribe from the organisational unit OrgUnitTestsUtil.assertUnsubscribeOrgUnit(simon.client, moduleUnit.id, simon.profile.id, function() { var events = _.sortBy(series[0].events, 'start'); var calendarStart = _.first(events).start; var calendarEnd = _.last(events).end; // Verify the user is no longer subscribed to anything UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, null, function(calendar) { assert.strictEqual(calendar.results.length, 0); return callback(); }); }); }); }); }); });
it('verify validation when adding and/or removing organisers from events', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { var start = moment().format(); var end = moment().add(2, 'hour').format(); EventsTestsUtil.assertCreateEvent(simon.client, 'Test event', start, end, null, function(event) { // Invalid event id EventsTestsUtil.assertUpdateEventOrganisersFails(simon.client, 'not a number', {'Jack': true}, 400, function() { // Unknown event id EventsTestsUtil.assertUpdateEventOrganisersFails(simon.client, -1, {'Jack': true}, 404, function() { // No organiser EventsTestsUtil.assertUpdateEventOrganisersFails(simon.client, event.id, {}, 400, function() { // Specified unknown user id EventsTestsUtil.assertUpdateEventOrganisersFails(simon.client, event.id, {'-1': true}, 400, function() { // Not a boolean value EventsTestsUtil.assertUpdateEventOrganisersFails(simon.client, event.id, {'Dr Jack Daniels': 'Not a boolean'}, 400, function() { return callback(); }); }); }); }); }); }); }); });
it('verify organisers can be added and/or removed from events', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 3, false, function(simon, nico, sam) { var start = moment().format(); var end = moment().add(2, 'hour').format(); // Create an event EventsTestsUtil.assertCreateEvent(simon.client, 'Test event', start, end, null, function(event) { // Add Nico as an organiser var update = {}; update[nico.profile.id] = true; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Add a plain-text organiser update = {'Mr Doo Little': true}; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Add Sam and a plain-text organiser update = {'Dr Jack Daniels': true}; update[sam.profile.id] = true; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Sanity-check all users are still persisted EventsTestsUtil.assertGetEvent(simon.client, event.id, null, function(event) { assert.strictEqual(event.organisers.length, 5); // Remove Sam update = {}; update[sam.profile.id] = false; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Remove a plain-text organiser update = {'Mr Doo Little': false}; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Remove Nico and a plain-text organiser update = {'Dr Jack Daniels': false}; update[nico.profile.id] = false; EventsTestsUtil.assertUpdateEventOrganisers(simon.client, event.id, update, function() { // Assert Simon is now the only organiser EventsTestsUtil.assertGetEvent(simon.client, event.id, null, function(event) { assert.strictEqual(event.organisers.length, 1); assert.strictEqual(event.organisers[0].id, simon.profile.id); return callback(); }); }); }); }); }); }); }); }); }); }); });
it('verify authorization when adding and/or removing organisers from events', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 4, false, function(simon, nico, sam, bert) { // Create an event that Nico organises var start = moment().format(); var end = moment().add(2, 'hour').format(); var opts = { 'organiserUsers': [nico.profile.id] }; EventsTestsUtil.assertCreateEvent(simon.client, 'Test event', start, end, opts, function(event) { var update = {'Dr Jack McJackerson': true}; // Anonymous users cannot update the organisers of an event TestsUtil.getAnonymousAppUserClient(global.tests.apps.cam2013, function(anonymousClient) { EventsTestsUtil.assertUpdateEventOrganisersFails(anonymousClient, event.id, update, 401, function() { TestsUtil.getAnonymousGlobalAdminRestClient(function(anonymousGlobalAdminClient) { EventsTestsUtil.assertUpdateEventOrganisersFails(anonymousGlobalAdminClient, event.id, update, 401, function() { // Authenticated users unrelated to the event cannot update the organisers of an event EventsTestsUtil.assertUpdateEventOrganisersFails(bert.client, event.id, update, 401, function() { // App admins from another application cannot update the organisers of an event EventsTestsUtil.assertUpdateEventOrganisersFails(global.tests.admins.oxford2014.client, event.id, update, 401, function() { // Organisers can update the organisers of the event EventsTestsUtil.assertUpdateEventOrganisers(nico.client, event.id, update, function() { // Members of the event's group can update the organisers of the event var membersUpdate = {}; membersUpdate[sam.profile.id] = true; GroupsTestsUtil.assertUpdateGroupMembers(simon.client, event.GroupId, membersUpdate, function() { EventsTestsUtil.assertUpdateEventOrganisers(sam.client, event.id, update, function() { // Application admins can update the organisers of an event EventsTestsUtil.assertUpdateEventOrganisers(global.tests.admins.cam2013.client, event.id, update, function() { // Global admins can update the organisers of the event TestsUtil.getGlobalAdminRestClient(function(globalAdminClient) { EventsTestsUtil.assertUpdateEventOrganisers(globalAdminClient, event.id, update, function() { return callback(); }); }); }); }); }); }); }); }); }); }); }); }); }); }); });
it('verify authorization when a user unsubscribes from an organisational unit', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 2, false, function(camUser, anotherCamUser) { TestsUtil.generateTestUsers(global.tests.apps.oxford2014, 1, false, function(oxfordUser) { // Generate some test series with some events on the cambridge app OrgUnitTestsUtil.createSimpleTree(global.tests.admins.cam2013.client, function(courseUnit, subjectUnit, partUnit, moduleUnit, series) { // Subscribe to some organisational units OrgUnitTestsUtil.assertSubscribeOrgUnit(camUser.client, moduleUnit.id, camUser.profile.id, function() { OrgUnitTestsUtil.assertSubscribeOrgUnit(camUser.client, partUnit.id, camUser.profile.id, function() { OrgUnitTestsUtil.assertSubscribeOrgUnit(camUser.client, subjectUnit.id, camUser.profile.id, function() { // Anonymous users cannot unsubscribe from an organisational unit TestsUtil.getAnonymousAppUserClient(global.tests.apps.cam2013, function(anonymousClient) { OrgUnitTestsUtil.assertUnsubscribeOrgUnitFails(anonymousClient, moduleUnit.id, camUser.profile.id, 401, function() { // Users cannot unsubscribe other users OrgUnitTestsUtil.assertUnsubscribeOrgUnitFails(anotherCamUser.client, moduleUnit.id, camUser.profile.id, 401, function() { // Users cannot unsubscribe other users from other applications OrgUnitTestsUtil.assertUnsubscribeOrgUnitFails(oxfordUser.client, moduleUnit.id, camUser.profile.id, 401, function() { // Users can unsubscribe themselves OrgUnitTestsUtil.assertUnsubscribeOrgUnit(camUser.client, moduleUnit.id, camUser.profile.id, function() { // App admins can unsubscribe users OrgUnitTestsUtil.assertUnsubscribeOrgUnit(global.tests.admins.cam2013.client, partUnit.id, camUser.profile.id, function() { // App admins cannot unsubscribe users from other applications OrgUnitTestsUtil.assertUnsubscribeOrgUnitFails(global.tests.admins.cam2013.client, partUnit.id, oxfordUser.profile.id, 401, function() { // App admins cannot subscribe users to organisational units from other applications OrgUnitTestsUtil.assertUnsubscribeOrgUnitFails(global.tests.admins.oxford2014.client, partUnit.id, oxfordUser.profile.id, 401, function() { // Global admins can unsubscribe users TestsUtil.getGlobalAdminRestClient(function(globalAdminClient) { OrgUnitTestsUtil.assertUnsubscribeOrgUnit(globalAdminClient, courseUnit.id, camUser.profile.id, function() { return callback(); }); }); }); }); }); }); }); }); }); }); }); }); }); }); }); }); });
it('verify a user can subscribe to an organisational unit without any series or events', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate a test organisational unit without any series or events OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test orgunit', 'type', null, function(orgUnit) { // Subscribe to the organisational unit OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, orgUnit.id, null, function() { return callback(); }); }); }); });
it('verify a user can subscribe to an organisational unit', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate an organisational unit structure that holds some series OrgUnitTestsUtil.createSimpleTree(global.tests.admins.cam2013.client, function(courseUnit, subjectUnit, partUnit, moduleUnit, series) { // Subscribe to the module OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, moduleUnit.id, null, function() { return callback(); }); }); }); });
TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { TestsUtil.generateTestUsers(global.tests.apps.oxford2014, 2, false, function(nico) { // Create an event that Nico organises var start = moment().format(); var end = moment().add(2, 'hour').format(); EventsTestsUtil.assertCreateEvent(simon.client, 'Test event', start, end, null, function(event) { var update = {}; update[nico.profile.id] = true; EventsTestsUtil.assertUpdateEventOrganisersFails(global.tests.admins.cam2013.client, event.id, update, 400, callback); }); }); });
it('verify deleting a series from an organisational unit removes the series from user calendars', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 2, false, function(simon, nico) { // Create an organisational unit with two series under it OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test org unit', 'module', null, function(orgUnit) { var calendarStart = moment().subtract(1, 'day').format(); var calendarEnd = moment().add(30, 'day').format(); SeriesTestsUtil.generateSerieWithEvents(global.tests.admins.cam2013.client, 1, 5, calendarStart, calendarEnd, function(series) { var series1 = series[0]; SeriesTestsUtil.generateSerieWithEvents(global.tests.admins.cam2013.client, 1, 5, calendarStart, calendarEnd, function(series) { var series2 = series[0]; OrgUnitTestsUtil.assertAddOrgUnitSeries(global.tests.admins.cam2013.client, orgUnit.id, [series1.id, series2.id], function() { // Simon subscribes to both series within the context of the organisational unit SeriesTestsUtil.assertSubscribeSeries(simon.client, series1.id, simon.profile.id, orgUnit.id, function() { SeriesTestsUtil.assertSubscribeSeries(simon.client, series2.id, simon.profile.id, orgUnit.id, function() { // Nico subscribes to both series, but doesn't provide a context SeriesTestsUtil.assertSubscribeSeries(nico.client, series1.id, nico.profile.id, null, function() { SeriesTestsUtil.assertSubscribeSeries(nico.client, series2.id, nico.profile.id, null, function() { // Remove series 1 from the organisational unit OrgUnitTestsUtil.assertDeleteOrgUnitSeries(global.tests.admins.cam2013.client, orgUnit.id, [series1.id], function() { // Verify the evens from series 1 have been removed from Simon's calendar but the events from series 2 are still present UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, series2.events, function(calendar) { assert.strictEqual(calendar.results.length, 5); var series1EventIds = _.pluck(series1.events, 'id'); _.each(calendar.results, function(event) { assert.ok(!_.contains(series1EventIds, event.id)); }); // Verify both series are still in Nico's calendar UsersTestsUtil.assertGetUserCalendar(nico.client, nico.profile.id, calendarStart, calendarEnd, _.union(series1.events, series2.events), function(calendar) { assert.strictEqual(calendar.results.length, 10); return callback(); }); }); }); }); }); }); }); }); }); }); }); }); });
OrgUnitTestsUtil.assertAddOrgUnitSeriesFails(anonymousGlobalClient, orgUnit.id, [serie.id], 401, function() { // Regular users can't add series to organisational units either TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { OrgUnitTestsUtil.assertAddOrgUnitSeriesFails(simon.client, orgUnit.id, [serie.id], 401, function() { // Application admins can't add series to organisational units from other applications OrgUnitTestsUtil.assertAddOrgUnitSeriesFails(global.tests.admins.oxford2014.client, orgUnit.id, [serie.id], 401, function() { // When users are a member of the organisational unit's group they can add a serie to it var update = {}; update[simon.profile.id] = true; GroupsTestsUtil.assertUpdateGroupMembers(global.tests.admins.cam2013.client, orgUnit.GroupId, update, function() { OrgUnitTestsUtil.assertAddOrgUnitSeries(simon.client, orgUnit.id, [serie.id], function() { return callback(); }); }); }); }); }); });
it('verify unsubscribing from an organisational unit only removes series and events from that organisational unit', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Generate two organisational unit structures that each hold some series OrgUnitTestsUtil.createSimpleTree(global.tests.admins.cam2013.client, function(courseUnit1, subjectUnit1, partUnit1, moduleUnit1, series1) { OrgUnitTestsUtil.createSimpleTree(global.tests.admins.cam2013.client, function(courseUnit2, subjectUnit2, partUnit2, moduleUnit2, series2) { // Subscribe to two organisational units OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, moduleUnit1.id, simon.profile.id, function() { OrgUnitTestsUtil.assertSubscribeOrgUnit(simon.client, moduleUnit2.id, simon.profile.id, function() { var module1Events = _.chain(series1).pluck('events').flatten().value(); var module2Events = _.chain(series2).pluck('events').flatten().value(); var allEvents = _.union(module1Events, module2Events); var calendarStart = _.chain(allEvents).sortBy('start').first().value().start; var calendarEnd = _.chain(allEvents).sortBy('end').last().value().end; // All the events should be in the calendar UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, allEvents, function(calendar) { assert.strictEqual(calendar.results.length, allEvents.length); // Unsubscribe from the first organisational unit OrgUnitTestsUtil.assertUnsubscribeOrgUnit(simon.client, moduleUnit1.id, simon.profile.id, function() { // The events of the second organisational unit should still be in the calendar UsersTestsUtil.assertGetUserCalendar(simon.client, simon.profile.id, calendarStart, calendarEnd, module2Events, function(calendar) { assert.strictEqual(calendar.results.length, module2Events.length); return callback(); }); }); }); }); }); }); }); }); });
it('verify serie subscription status is returned if including series', function(callback) { TestsUtil.generateTestUsers(global.tests.apps.cam2013, 1, false, function(simon) { // Create an organisational unit OrgUnitTestsUtil.assertCreateOrgUnit(global.tests.admins.cam2013.client, 'Test org unit', 'course', null, function(createdOrgUnit) { // Create a serie SeriesTestsUtil.assertCreateSerie(global.tests.admins.cam2013.client, 'Test serie', null, function(serie) { // Add the serie to the organisational unit OrgUnitTestsUtil.assertAddOrgUnitSeries(global.tests.admins.cam2013.client, createdOrgUnit.id, [serie.id], function() { // Sanity-check that we're not subscribed yet OrgUnitTestsUtil.assertGetOrgUnits(simon.client, null, true, null, null, null, function(orgUnits) { _.each(orgUnits.results, function(orgUnit) { _.each(orgUnit.Series, function(serie) { assert.strictEqual(serie.subscribed, false); }); }); // Subscribe to the serie SeriesTestsUtil.assertSubscribeSeries(simon.client, serie.id, simon.profile.id, null, function() { // Verify the subscription status OrgUnitTestsUtil.assertGetOrgUnits(simon.client, null, true, null, null, null, function(orgUnits) { var seenSerie = false; _.each(orgUnits.results, function(orgUnit) { if (orgUnit.id === createdOrgUnit.id) { // Assert the serie is present and that the user is subscribed to it assert.ok(orgUnit.Series); assert.strictEqual(orgUnit.Series.length, 1); assert.strictEqual(orgUnit.Series[0].id, serie.id); assert.strictEqual(orgUnit.Series[0].subscribed, true); seenSerie = true; } else { // The user is not subscribed to any other series _.each(orgUnit.Series, function(serie) { assert.strictEqual(serie.subscribed, false); }); } }); // Ensure that we asserted that the user is subscribed to the serie assert.ok(seenSerie); // Unsubscribe from the serie SeriesTestsUtil.assertUnsubscribeSeries(simon.client, serie.id, simon.profile.id, function() { // Verify the subscription status OrgUnitTestsUtil.assertGetOrgUnits(simon.client, null, true, null, null, null, function(orgUnits) { _.each(orgUnits.results, function(orgUnit) { _.each(orgUnit.Series, function(serie) { assert.strictEqual(serie.subscribed, false); }); }); return callback(); }); }); }); }); }); }); }); }); }); });