Skip to content

Commit

Permalink
Updates for new pagination defaults (25)
Browse files Browse the repository at this point in the history
  • Loading branch information
uzquiano committed Sep 30, 2013
1 parent 50e836e commit 5d4f7b8
Show file tree
Hide file tree
Showing 25 changed files with 196 additions and 61 deletions.
20 changes: 15 additions & 5 deletions tests/js/testActivities1.js
Expand Up @@ -13,7 +13,9 @@
// NOTE: this = platform

var platformActivityCount = -1;
this.listActivities().count(function(count) {
this.listActivities({
"limit": -1
}).count(function(count) {
platformActivityCount = count;
});

Expand All @@ -29,7 +31,9 @@
this.then(function() {

// list platform activities
this.listActivities().count(function(count) {
this.listActivities({
"limit": -1
}).count(function(count) {
ok(count > platformActivityCount, "Platform activity account increased");
platformActivityCount = count;
});
Expand All @@ -41,7 +45,9 @@

// list domain activities
var domainActivityCount = -1;
this.listActivities().count(function(count) {
this.listActivities({
"limit": -1
}).count(function(count) {
domainActivityCount = count;
});

Expand All @@ -53,7 +59,9 @@
});

// list domain activities
this.listActivities().count(function(count) {
this.listActivities({
"limit": -1
}).count(function(count) {
ok(count > domainActivityCount, "Domain activity count increased");
});
});
Expand All @@ -62,7 +70,9 @@
});

// list platform activities
this.listActivities().count(function(count) {
this.listActivities({
"limit": -1
}).count(function(count) {
ok(count > platformActivityCount, "Platform activity account increased (second time)");
success();
});
Expand Down
12 changes: 9 additions & 3 deletions tests/js/testApplication1.js
Expand Up @@ -18,7 +18,9 @@
var key = "key-" + new Date().getTime();

var originalCount = -1;
this.listApplications().count(function(count) {
this.listApplications({
"limit": -1
}).count(function(count) {
originalCount = count;
});

Expand All @@ -29,7 +31,9 @@
}).then(function() {
application = this;
});
this.listApplications().count(function(count) {
this.listApplications({
"limit": -1
}).count(function(count) {
equal(count, originalCount + 1, "Application count + 1");
});

Expand All @@ -43,7 +47,9 @@

this.readApplication(application.getId()).update().del();

this.listApplications().count(function(count) {
this.listApplications({
"limit": -1
}).count(function(count) {
equal(count, originalCount, "Application back to what it was");
});

Expand Down
4 changes: 3 additions & 1 deletion tests/js/testAuthentication12.js
Expand Up @@ -164,7 +164,9 @@
var f3 = function(client, ticket, accessToken, refreshToken, grantTime)
{
// try to do something with the platform (here we list registrars)
this.listRegistrars().then(function() {
this.listRegistrars({
"limit": -1
}).then(function() {

Chain(this.getPlatform()).then(function() {

Expand Down
8 changes: 6 additions & 2 deletions tests/js/testAuthentication13.js
Expand Up @@ -136,7 +136,9 @@
window.setTimeout(function() {

// list registrars
Chain(platform).listRegistrars().then(function() {
Chain(platform).listRegistrars({
"limit": -1
}).then(function() {

var newTicket1 = this.getDriver().getAuthInfo().getTicket();
ok(newTicket1, "Pass1: Acquired a new ticket");
Expand All @@ -159,7 +161,9 @@
window.setTimeout(function() {

// list registrars
Chain(platform).listRegistrars().then(function() {
Chain(platform).listRegistrars({
"limit": -1
}).then(function() {

var newTicket2 = this.getDriver().getAuthInfo().getTicket();
ok(newTicket2, "Pass2: Acquired a new ticket");
Expand Down
4 changes: 3 additions & 1 deletion tests/js/testAuthentication3.js
Expand Up @@ -26,7 +26,9 @@

// NOTE: this = platform

this.listRepositories().then(function() {
this.listRepositories({
"limit": -1
}).then(function() {

ok(true, "First authentication worked");

Expand Down
8 changes: 6 additions & 2 deletions tests/js/testAuthentication5.js
Expand Up @@ -30,7 +30,9 @@

this.createRepository();

this.listRepositories().count(function(count) {
this.listRepositories({
"limit": -1
}).count(function(count) {

ok(count > 0, "Count was greater than zero");
});
Expand All @@ -40,7 +42,9 @@
// cookie should be gone
ok(!Gitana.readCookie("GITANA_TICKET", "Cookie was deleted"));

this.listRepositories().then(function() {
this.listRepositories({
"limit": -1
}).then(function() {
ok(false, "Should not have made it this far");
});
});
Expand Down
8 changes: 6 additions & 2 deletions tests/js/testAuthentication8.js
Expand Up @@ -23,7 +23,9 @@
ok(true, "Successfully authenticated");

// list domains
this.listDomains().then(function() {
this.listDomains({
"limit": -1
}).then(function() {
ok(true, "First list worked");
});

Expand All @@ -34,7 +36,9 @@

// list domains again
// this time the refresh token should be automatically used to re-acquire an access token
this.listDomains().then(function() {
this.listDomains({
"limit": -1
}).then(function() {
ok(true, "Second list worked");
});

Expand Down
8 changes: 6 additions & 2 deletions tests/js/testAutoClientMapping1.js
Expand Up @@ -43,7 +43,9 @@

this.then(function() {

this.listAutoClientMappings().count(function(count) {
this.listAutoClientMappings({
"limit": -1
}).count(function(count) {
equal(count, 3, "Found 3 auto client mappings");
});

Expand All @@ -70,7 +72,9 @@
this.readAutoClientMapping(acm3.getId()).update().del();

// list
this.listAutoClientMappings().count(function(count) {
this.listAutoClientMappings({
"limit": -1
}).count(function(count) {
equal(count, 2, "Auto Client Mapping now 2");
});

Expand Down
4 changes: 3 additions & 1 deletion tests/js/testDirectory1.js
Expand Up @@ -37,7 +37,9 @@
});

// then test out deletes
this.listDirectories().then(function() {
this.listDirectories({
"limit": -1
}).then(function() {

var directory2 = this.get(directory.getId());
ok(directory2, "Successfully retrieved from list");
Expand Down
4 changes: 3 additions & 1 deletion tests/js/testDomain1.js
Expand Up @@ -37,7 +37,9 @@
});

// then test out deletes
this.listDomains().then(function() {
this.listDomains({
"limit": -1
}).then(function() {

var domain2 = this.get(domain.getId());
ok(domain2, "Successfully retrieved from list");
Expand Down
8 changes: 6 additions & 2 deletions tests/js/testDomainPrincipal1.js
Expand Up @@ -21,7 +21,9 @@
var count = 0;

// first: list and count all of the users manually
this.listUsers().count(function(c) {
this.listUsers({
"limit": -1
}).count(function(c) {
count = c;
});

Expand All @@ -37,7 +39,9 @@
// third: list users again and verify size + 1
// list users
var recount = 0;
this.listUsers().count(function(c) {
this.listUsers({
"limit": -1
}).count(function(c) {
recount = c;
equals(recount, count + 1, "Size incremented by 1");
});
Expand Down
8 changes: 6 additions & 2 deletions tests/js/testDomainPrincipal2.js
Expand Up @@ -20,7 +20,9 @@

// count the number of groups
var count = 0;
this.listGroups().each(function() {
this.listGroups({
"limit": -1
}).each(function() {
count++;
});

Expand All @@ -35,7 +37,9 @@

// list groups and verify size + 1
var recount = 0;
this.listGroups().each(function() {
this.listGroups({
"limit": -1
}).each(function() {
recount++;
}).then(function() {
equals(recount, count + 1, "Size incremented by 1");
Expand Down
24 changes: 18 additions & 6 deletions tests/js/testDomainPrincipal3.js
Expand Up @@ -32,13 +32,17 @@

// count the number of users
var userCount = 0;
this.listUsers().count(function(count) {
this.listUsers({
"limit": -1
}).count(function(count) {
userCount = count;
});

// counter the number of groups
var groupCount = 0;
this.listUsers().count(function(count) {
this.listUsers({
"limit": -1
}).count(function(count) {
groupCount = count;
});

Expand Down Expand Up @@ -114,16 +118,24 @@
this.addMember(test.group3, test.user6);

// verify memberships
this.listMembers(test.group1, "user").count(function(count) {
this.listMembers(test.group1, "user", {
"limit": -1
}).count(function(count) {
equal(count, 2, "Group 1 has two users");
});
this.listMembers(test.group2, "group").count(function(count) {
this.listMembers(test.group2, "group", {
"limit": -1
}).count(function(count) {
equal(count, 1, "Group 2 has one child group");
});
this.listMembers(test.group2, "user").count(function(count) {
this.listMembers(test.group2, "user", {
"limit": -1
}).count(function(count) {
equal(count, 1, "Group 2 has one user");
});
this.listMembers(test.group3, "user").count(function(count) {
this.listMembers(test.group3, "user", {
"limit": -1
}).count(function(count) {
equal(count, 3, "Group 3 has three users");
});

Expand Down
7 changes: 6 additions & 1 deletion tests/js/testDomainPrincipal4.js
Expand Up @@ -126,7 +126,12 @@

// test sorting of users on query
var index = 0;
this.listUsers({"sort":{"title": 1}}).each(function() {
this.listUsers({
"sort":{
"title": 1
},
"limit": -1
}).each(function() {

if (this.get("tag") == tag)
{
Expand Down
16 changes: 12 additions & 4 deletions tests/js/testNodeDictionary1.js
Expand Up @@ -15,22 +15,30 @@
// NOTE: this = branch

// list all definitions
this.listDefinitions().count(function(count) {
this.listDefinitions({
"limit": -1
}).count(function(count) {
ok(count > 0, "Found definitions");
});

// list type definitions
this.listDefinitions("type").count(function(count) {
this.listDefinitions("type", {
"limit": -1
}).count(function(count) {
ok(count > 0, "Found type definitions");
});

// list association type definitions
this.listDefinitions("association").count(function(count) {
this.listDefinitions("association", {
"limit": -1
}).count(function(count) {
ok(count > 0, "Found association type definitions");
});

// list feature definitions
this.listDefinitions("feature").count(function(count) {
this.listDefinitions("feature", {
"limit": -1
}).count(function(count) {
ok(count > 0, "Found feature definitions");
});

Expand Down

0 comments on commit 5d4f7b8

Please sign in to comment.