sakaiproject/Hilary — pull request #353 by stuartf (2013-01-29 15:00:30+00:00)
Title: Accidental use of `assert.ok` instead of `assert.equal`

Seems like there are quite a few places where where "ok" is used when an "equal" check was intended. The result is that if the first parameter doesn't evaluate to false, then the check succeeds. Should fix the bad assert calls and any bugs that are discovered as a result. It's entirely possible that I caused every single one of these.

Unfortunately I'm not sure that it's lint-able, since as you can see the the reg-ex will find quite a few false positives.

```
Hilary$ git grep "assert\\.ok.*,"
node_modules/oae-authentication/tests/test-auth-local.js: assert.ok(err.code, 401);
node_modules/oae-authentication/tests/test-auth-local.js: assert.ok(err.code, 401);
node_modules/oae-authentication/tests/test-signed.js: assert.ok(user.isGlobalAdmin, 'The user should still be a global administrator');
node_modules/oae-authz/tests/test-groups.js: assert.ok(!_.find(members, function(member){ if (member.id === memberId) { return member.role; }}));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.find(members, function(member) {
node_modules/oae-authz/tests/test-groups.js: assert.ok(members.length, 1);
node_modules/oae-authz/tests/test-groups.js: assert.ok(members[0].id, memberId);
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId3));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId1));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId2));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId3));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId4));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId5));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId6));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId4));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId5));
node_modules/oae-authz/tests/test-groups.js: assert.ok(_.contains(groupIds, groupId6));
node_modules/oae-authz/tests/test-roles.js: assert.ok(entries[resourceId]['manager'], 'Expected the "manager" role to be available on each overlapping content item.');
node_modules/oae-authz/tests/test-roles.js: assert.ok(entries[resourceId]['viewer'], 'Expected the "viewer" role to be available on each overlapping content item.');
node_modules/oae-config/tests/test-config.js: assert.ok(schema['oae-authentication']['twitter'].elements['enabled'], true);
node_modules/oae-config/tests/test-config.js: assert.ok(schema['oae-authentication']['twitter'].elements['enabled'], true);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(revisions.length, 2);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(contentB.contentId, contentObj.contentId);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 401);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.filename, 'sakaiger.png');
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.mime, 'image/png');
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.contentId, contentId);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.displayName, expectedName);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.description, expectedDescription);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.contentId, contentId);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.displayName, expectedName);
node_modules/oae-content/tests/test-content.js: assert.ok(contentObj.description, expectedDescription);
node_modules/oae-content/tests/test-content.js: assert.ok(revisionsSimon.length, 2);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-content.js: assert.ok(err.code, 400);
node_modules/oae-content/tests/test-library-search.js: assert.ok(results.results.length, 1);
node_modules/oae-content/tests/test-library-search.js: assert.ok(results.results.length, 1);
node_modules/oae-principals/tests/test-cropping.js: assert.ok(response.statusCode, 204);
node_modules/oae-principals/tests/test-cropping.js: assert.ok(response.statusCode, 204);
node_modules/oae-principals/tests/test-cropping.js: assert.ok(response.statusCode, 204);
node_modules/oae-principals/tests/test-cropping.js: assert.ok(request.statusCode, 204);
node_modules/oae-principals/tests/test-cropping.js: assert.ok(request.statusCode, 204);
node_modules/oae-principals/tests/test-cropping.js: // assert.ok(request.statusCode, 204);
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.id, groupId);
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.displayName, 'Group title');
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.id, groupId);
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.displayName, 'Group title');
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.id, groupId);
node_modules/oae-principals/tests/test-groups.js: assert.ok(groupObj.displayName, 'Group title');
node_modules/oae-principals/tests/test-groups.js: assert.ok(err.msg, 401);
node_modules/oae-principals/tests/test-groups.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-groups.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-groups.js: assert.ok(retrievedGroupObj.id, groupObj.id);
node_modules/oae-principals/tests/test-groups.js: assert.ok(retrievedGroupObj.displayName, groupObj.displayName);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(results.results.length, 2);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(results.results.length, 1);
node_modules/oae-principals/tests/test-members-search.js: assert.ok(results.results.length, 1);
node_modules/oae-principals/tests/test-memberships-search.js: assert.ok(_getDocById(results, groupChild.id));
node_modules/oae-principals/tests/test-memberships-search.js: assert.ok(_getDocById(results, groupParent.id));
node_modules/oae-principals/tests/test-memberships-search.js: assert.ok(results.results.length, 2);
node_modules/oae-principals/tests/test-memberships-search.js: assert.ok(results.results.length, 1);
node_modules/oae-principals/tests/test-memberships-search.js: assert.ok(results.results.length, 1);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 404);
node_modules/oae-principals/tests/test-users.js: assert.ok(!userObj.isTenantAdmin(global.oaeTests.tenants.cam.alias), 'Expected user to not be update-able to tenant or global ad
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 401);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-principals/tests/test-users.js: assert.ok(err.code, 400);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(section.field1, 'Test1');
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(section.field2, 'Test2');
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 401);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 400);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 400);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 400);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 403);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 401);
node_modules/oae-profiles/tests/test-profiles.js: assert.ok(err.code, 403);
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, mrvisser.user.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, mrvisser.user.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, oaeTeam.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, xyzTeam.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, xyzTeam.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, contentObj.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, jack.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, group.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, content.contentId));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, group1.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, group2.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(_getDocById(results, group1.id));
node_modules/oae-search/tests/test-general-search.js: assert.ok(!_getDocById(results, group2.id));
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam('cats', 'dogs'), 'cats');
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam('cats'), 'cats');
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam('', 'cats'), 'cats');
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam('', ''), SearchConstants.query.ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam(null, 'cats'), 'cats');
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam(null, null), SearchConstants.query.ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam(undefined, 'cats'), 'cats');
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getQueryParam(), SearchConstants.query.ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(validType, validType2), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam('not-valid', validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam('not-valid', 'not-valid'), SearchConstants.general.RESOURCE_TYPE_ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(null, validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(null, null), SearchConstants.general.RESOURCE_TYPE_ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(undefined, validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getResourceTypeParam(), SearchConstants.general.RESOURCE_TYPE_ALL);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(validType, validType2), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam('not-valid', validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam('not-valid', 'not-valid'), SearchConstants.sort.ASC);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(null, validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(null, null), SearchConstants.sort.ASC);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(undefined, validType), validType);
node_modules/oae-search/tests/test-search-util.js: assert.ok(SearchUtil.getSortParam(), SearchConstants.sort.ASC);
node_modules/oae-tenants/tests/test-tenants.js: assert.ok(_.contains(TenantsAPI.getRunningTenantAliases(), 'aartest'));
node_modules/oae-tenants/tests/test-tenants.js: assert.ok(err.code, 503);
node_modules/oae-tenants/tests/test-tenants.js: assert.ok(!_.contains(TenantsAPI.getRunningTenantAliases(), 'aartest'));
node_modules/oae-ui/tests/test-ui.js: assert.ok(_.keys(data).length, 1);
node_modules/oae-ui/tests/test-ui.js: assert.ok(_.keys(data).length, 1);
```