Skip to content

Commit

Permalink
Convert all tests to Proof.
Browse files Browse the repository at this point in the history
Converted the parser tests to Proof. Many of them were redundant. They
were created at a time when I thought that it would be reasonable to
implement all the examples in the AWS documentation.

I suppose it didn't seem like such a great idea somewhere in the middle
of the "d"s.

Keeping them, though. Tests are tests. But many have the same XML
structure, while some have identical XML.
  • Loading branch information
flatheadmill committed Jun 28, 2012
1 parent 67a4b88 commit f5f7b79
Show file tree
Hide file tree
Showing 20 changed files with 226 additions and 101 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -12,6 +12,6 @@
, "devDependencies":
{ "proof": "0.0.7" }
, "lib" : "lib"
, "scripts" : { "test": "proof t/repsonse/error.t" }
, "scripts" : { "test": "proof t/*/*.t" }
, "engines" : { "node": "> 0.6.0" }
}
8 changes: 8 additions & 0 deletions t/response/allocate-address.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("AllocateAddress", callback("object"));
}, function (object, deepEqual) {
var expected = { "publicIp": "67.202.55.255" };
deepEqual(expected, object, "parse allocate address");
});
14 changes: 14 additions & 0 deletions t/response/attach-volume.t
@@ -0,0 +1,14 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("AttachVolume", callback("object"));
}, function (object, deepEqual) {
var expected =
{ volumeId: "vol-4d826724"
, instanceId: "i-6058a509"
, device: "/dev/sdh"
, status: "attaching"
, attachTime: new Date(Date.UTC(2008, 4, 7, 11, 51, 50))
};
deepEqual(expected, object, "parse attach volume");
});
9 changes: 9 additions & 0 deletions t/response/authorize-security-group-ingress.t
@@ -0,0 +1,9 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("AuthorizeSecurityGroupIngress", callback("object"));
}, function (object, deepEqual) {
var expected = { "return": true };
deepEqual(expected, object, "parse authorize security group ingress");
});

24 changes: 24 additions & 0 deletions t/response/bundle-instance.t
@@ -0,0 +1,24 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("BundleInstance", callback("object"));
}, function (object, deepEqual) {
var expected =
{ requestId: "bun-c1a540a8"
, bundleInstanceTask:
{ instanceId: "i-12345678"
, bundleId: "bun-c1a540a8"
, state: "bundling"
, startTime: new Date(Date.UTC(2008, 9, 7, 11, 41, 50))
, updateTime: new Date(Date.UTC(2008, 9, 7, 11, 51, 50))
, progress: "70%"
, storage:
{ S3:
{ bucket: "my-bucket"
, prefix: "winami"
}
}
}
};
deepEqual(expected, object, "parse bundle instance");
});
24 changes: 24 additions & 0 deletions t/response/cancel-bundle-task.t
@@ -0,0 +1,24 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CancelBundleTask", callback("object"));
}, function (object, deepEqual) {
var expected =
{ bundleInstanceTask:
{ instanceId: "i-12345678"
, bundleId: "bun-cla322b9"
, state: "canceling"
, startTime: new Date(Date.UTC(2008, 9, 7, 11, 41, 50))
, updateTime: new Date(Date.UTC(2008, 9, 7, 11, 51, 50))
, progress: "20%"
, storage:
{ S3:
{ bucket: "my-bucket"
, prefix: "my-new-image"
}
}
}
};
deepEqual(expected, object, "parse cancel bundle task");
});

11 changes: 11 additions & 0 deletions t/response/cancel-spot-instance-requests.t
@@ -0,0 +1,11 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CancelSpotInstanceRequests", callback("object"));
}, function (object, deepEqual) {
var expected =
{ requestId: "59dbff89-35bd-4eac-99ed-be587ed81825"
, spotInstanceRequestSet: [ { spotInstanceRequestId: 'sir-e95fae02', state: "cancelled" } ]
};
deepEqual(expected, object, "parse cancel spot instance requests");
});
11 changes: 11 additions & 0 deletions t/response/confirm-product-instance.t
@@ -0,0 +1,11 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("ConfirmProductInstance", callback("object"));
}, function (object, deepEqual) {
var expected =
{ ownerId: "254933287430"
, "return": true
};
deepEqual(expected, object, "parse confirm product instance");
});
8 changes: 8 additions & 0 deletions t/response/create-image.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateImage", callback("object"));
}, function (object, deepEqual) {
var expected = { imageId: "ami-4fa54026" };
deepEqual(expected, object, "parse create image");
});
12 changes: 12 additions & 0 deletions t/response/create-key-pair.t
@@ -0,0 +1,12 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateKeyPair", callback("object"));
}, function (object, deepEqual) {
var expected =
{ keyName: "gsg-keypair"
, keyFingerprint: "1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f"
, keyMaterial: "-----BEGIN RSA PRIVATE KEY-----\nMIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp\nHungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg\n5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/\nebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5\ni8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5\n91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM\nZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7\n3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA\nSWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI\ntE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1\njUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco\nxW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC\niDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm\nrdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB\ngC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC\nDQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V\nrBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm\ngK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4\nJZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT\nP8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe\n2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==\n-----END RSA PRIVATE KEY-----"
};
deepEqual(expected, object, "parse errors");
});
11 changes: 11 additions & 0 deletions t/response/create-placement-group.t
@@ -0,0 +1,11 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreatePlacementGroup", callback("object"));
}, function (object, deepEqual) {
var expected =
{ requestId: "d4904fd9-82c2-4ea5-adfe-a9cc3EXAMPLE"
, "return": true
};
deepEqual(expected, object, "parse create placement group");
});
8 changes: 8 additions & 0 deletions t/response/create-security-group.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateSecurityGroup", callback("object"));
}, function (object, deepEqual) {
var expected = { "return": true };
deepEqual(expected, object, "parse errors");
});
18 changes: 18 additions & 0 deletions t/response/create-snapshot.t
@@ -0,0 +1,18 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateSnapshot", callback("object"));
}, function (object, deepEqual) {
var expected =
{ snapshotId: "snap-78a54011"
, volumeId: "vol-4d826724"
, volumeSize: 10
, status: "pending"
, startTime: new Date(Date.UTC(2008, 4, 7, 12, 51, 50))
, progress: "60%"
, ownerId: "213457642086"
, description: "Daily Backup"
};
deepEqual(expected, object, "parse create snapshot");
});

16 changes: 16 additions & 0 deletions t/response/create-spot-datafeed-subscription.t
@@ -0,0 +1,16 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateSpotDatafeedSubscription", callback("object"));
}, function (object, deepEqual) {
var expected =
{ spotDatafeedSubscription:
{ ownerId: "254933287430"
, bucket: "my-bucket"
, prefix: null
, state: "open"
}
};
deepEqual(expected, object, "parse create spot datafeed subscription");
});

16 changes: 16 additions & 0 deletions t/response/create-volume.t
@@ -0,0 +1,16 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("CreateVolume", callback("object"));
}, function (object, deepEqual) {
var expected =
{ volumeId: "vol-4d826724"
, size: 800
, status: "creating"
, createTime: new Date(Date.UTC(2008, 4, 7, 11, 51, 50))
, availabilityZone: "us-east-1a"
, snapshotId: null
};
deepEqual(expected, object, "parse create volume");
});

8 changes: 8 additions & 0 deletions t/response/delete-key-pair.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("DeleteKeyPair", callback("object"));
}, function (object, deepEqual) {
var expected = { "return": true };
deepEqual(expected, object, "parse delete key pair");
});
11 changes: 11 additions & 0 deletions t/response/delete-placement-group.t
@@ -0,0 +1,11 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("DeletePlacementGroup", callback("object"));
}, function (object, deepEqual) {
var expected =
{ requestId: "d4904fd9-82c2-4ea5-adfe-a9cc3EXAMPLE"
, "return": true
};
deepEqual(expected, object, "parse delete placement group");
});
8 changes: 8 additions & 0 deletions t/response/delete-security-group.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("DeleteSecurityGroup", callback("object"));
}, function (object, deepEqual) {
var expected = { "return": true };
deepEqual(expected, object, "parse delete security group");
});
8 changes: 8 additions & 0 deletions t/response/delete-snapshot.t
@@ -0,0 +1,8 @@
#!/usr/bin/env node

require("./proof")(1, function (parse, callback) {
parse("DeleteSnapshot", callback("object"));
}, function (object, deepEqual) {
var expected = { "return": true };
deepEqual(expected, object, "parse delete snapshot");
});
100 changes: 0 additions & 100 deletions test/response.coffee

This file was deleted.

0 comments on commit f5f7b79

Please sign in to comment.