summaryrefslogtreecommitdiff
path: root/indra/llmessage/tests/test_llsdmessage_peer.py
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-06-08 17:29:56 -0700
committerMerov Linden <merov@lindenlab.com>2012-06-08 17:29:56 -0700
commitac6f0304c51b6b8c8e4414ff1bc254be78f0845d (patch)
tree0b211c8c84ff92e6cdbeeb8d0197314e4821a60c /indra/llmessage/tests/test_llsdmessage_peer.py
parent1aba6c119ef05a4cfd91325c8455dc8c60098746 (diff)
parentcdb57cb299097b203581a6ef99840350831c321c (diff)
Merge pull from richard/viewer-chui
Diffstat (limited to 'indra/llmessage/tests/test_llsdmessage_peer.py')
-rw-r--r--indra/llmessage/tests/test_llsdmessage_peer.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py
index 22edd9dad8..fe4f3a8c01 100644
--- a/indra/llmessage/tests/test_llsdmessage_peer.py
+++ b/indra/llmessage/tests/test_llsdmessage_peer.py
@@ -78,25 +78,32 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
## debug("root node tag %s", tree.getroot().tag)
## return llsd.to_python(tree.getroot())
- def do_GET(self):
+ def do_HEAD(self):
+ self.do_GET(withdata=False)
+
+ def do_GET(self, withdata=True):
# Of course, don't attempt to read data.
- self.answer(dict(reply="success", status=500,
- reason="Your GET operation requested failure"))
+ data = dict(reply="success", body="avatar", random=17)
+ self.answer(data, withdata=withdata)
def do_POST(self):
# Read the provided POST data.
self.answer(self.read_xml())
- def answer(self, data):
+ def answer(self, data, withdata=True):
debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
if "fail" not in self.path:
- response = llsd.format_xml(data.get("reply", llsd.LLSD("success")))
+ data = data.copy() # we're going to modify
+ # Ensure there's a "reply" key in data, even if there wasn't before
+ data["reply"] = data.get("reply", llsd.LLSD("success"))
+ response = llsd.format_xml(data)
debug("success: %s", response)
self.send_response(200)
self.send_header("Content-type", "application/llsd+xml")
self.send_header("Content-Length", str(len(response)))
self.end_headers()
- self.wfile.write(response)
+ if withdata:
+ self.wfile.write(response)
else: # fail requested
status = data.get("status", 500)
# self.responses maps an int status to a (short, long) pair of