txaws-dev team mailing list archive
-
txaws-dev team
-
Mailing list archive
-
Message #00009
[Merge] lp:~jkakar/txaws/discover-shows-url into lp:txaws
Jamu Kakar has proposed merging lp:~jkakar/txaws/discover-shows-url into lp:txaws.
Requested reviews:
txAWS Developers (txaws-dev)
Related bugs:
#629440 txaws-discover should print the URL used when the request is made
https://bugs.launchpad.net/bugs/629440
This branch introduces the following changes:
- txaws-discover now outputs the URL used to make the request, in
addition to the HTTP status code and the response body.
--
https://code.launchpad.net/~jkakar/txaws/discover-shows-url/+merge/34528
Your team txAWS Developers is requested to review the proposed merge of lp:~jkakar/txaws/discover-shows-url into lp:txaws.
=== modified file 'txaws/client/discover/command.py'
--- txaws/client/discover/command.py 2010-06-21 15:59:10 +0000
+++ txaws/client/discover/command.py 2010-09-03 12:20:56 +0000
@@ -55,6 +55,10 @@
other_params=self.parameters)
def write_response(response):
+ url = "%s?%s" % (region.ec2_endpoint.get_uri(),
+ query.get_canonical_query_params())
+ print >>self.output, "URL: %s" % url
+ print >>self.output
print >>self.output, "HTTP status code: %s" % query.client.status
print >>self.output
print >>self.output, response
@@ -66,6 +70,11 @@
message = failure.getErrorMessage()
if message.startswith("Error Message: "):
message = message[len("Error Message: "):]
+
+ url = "%s?%s" % (region.ec2_endpoint.get_uri(),
+ query.get_canonical_query_params())
+ print >>self.output, "URL: %s" % url
+ print >>self.output
print >>self.output, "HTTP status code: %s" % query.client.status
print >>self.output
print >>self.output, message
=== modified file 'txaws/client/discover/tests/test_command.py'
--- txaws/client/discover/tests/test_command.py 2010-06-04 22:38:29 +0000
+++ txaws/client/discover/tests/test_command.py 2010-09-03 12:20:56 +0000
@@ -68,17 +68,19 @@
self.prepare_command("The response", 200, "DescribeRegions")
def check(result):
- self.assertEqual("GET", self.method)
- self.assertEqual(
+ url = (
"http://endpoint?AWSAccessKeyId=key&"
"Action=DescribeRegions&"
"Signature=uAlV2ALkp7qTxZrTNNuJhHl0i9xiTK5faZOhJTgGS1E%3D&"
"SignatureMethod=HmacSHA256&SignatureVersion=2&"
- "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01",
- self.url)
- self.assertEqual("HTTP status code: 200\n"
- "\n"
- "The response\n",
+ "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01")
+ self.assertEqual("GET", self.method)
+ self.assertEqual(url, self.url)
+ self.assertEqual("URL: %s\n"
+ "\n"
+ "HTTP status code: 200\n"
+ "\n"
+ "The response\n" % url,
self.output.getvalue())
deferred = self.command.run()
@@ -91,17 +93,19 @@
{"RegionName.0": "us-west-1"})
def check(result):
- self.assertEqual("GET", self.method)
- self.assertEqual(
+ url = (
"http://endpoint?AWSAccessKeyId=key&"
"Action=DescribeRegions&RegionName.0=us-west-1&"
"Signature=P6C7cQJ7j93uIJyv2dTbpQG3EI7ArGBJT%2FzVH%2BDFhyY%3D&"
"SignatureMethod=HmacSHA256&SignatureVersion=2&"
- "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01",
- self.url)
- self.assertEqual("HTTP status code: 200\n"
- "\n"
- "The response\n",
+ "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01")
+ self.assertEqual("GET", self.method)
+ self.assertEqual(url, self.url)
+ self.assertEqual("URL: %s\n"
+ "\n"
+ "HTTP status code: 200\n"
+ "\n"
+ "The response\n" % url,
self.output.getvalue())
deferred = self.command.run()
@@ -118,22 +122,23 @@
self.get_error_page)
def check(result):
- self.assertEqual("GET", self.method)
- self.assertEqual(
+ url = (
"http://endpoint?AWSAccessKeyId=key&"
"Action=DescribeRegions&RegionName.0=us-west-1&"
"Signature=P6C7cQJ7j93uIJyv2dTbpQG3EI7ArGBJT%2FzVH%2BDFhyY%3D&"
"SignatureMethod=HmacSHA256&SignatureVersion=2&"
- "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01",
- self.url)
- self.assertEqual("HTTP status code: 400\n"
- "\n"
- "The error response\n",
+ "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01")
+ self.assertEqual("GET", self.method)
+ self.assertEqual(url, self.url)
+ self.assertEqual("URL: %s\n"
+ "\n"
+ "HTTP status code: 400\n"
+ "\n"
+ "The error response\n" % url,
self.output.getvalue())
deferred = self.command.run()
- deferred.addErrback(check)
- return deferred
+ return self.assertFailure(deferred, Exception).addErrback(check)
def test_run_with_error_strips_non_response_text(self):
"""
@@ -146,17 +151,19 @@
self.get_error_page)
def check(result):
- self.assertEqual("GET", self.method)
- self.assertEqual(
+ url = (
"http://endpoint?AWSAccessKeyId=key&"
"Action=DescribeRegions&RegionName.0=us-west-1&"
"Signature=P6C7cQJ7j93uIJyv2dTbpQG3EI7ArGBJT%2FzVH%2BDFhyY%3D&"
"SignatureMethod=HmacSHA256&SignatureVersion=2&"
- "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01",
- self.url)
- self.assertEqual("HTTP status code: 400\n"
- "\n"
- "The error response\n",
+ "Timestamp=2010-06-04T23%3A40%3A00Z&Version=2008-12-01")
+ self.assertEqual("GET", self.method)
+ self.assertEqual(url, self.url)
+ self.assertEqual("URL: %s\n"
+ "\n"
+ "HTTP status code: 400\n"
+ "\n"
+ "The error response\n" % url,
self.output.getvalue())
deferred = self.command.run()