diff options
| author | Jan Tuomi <jan-sebastian.tuomi@aalto.fi> | 2016-07-18 19:20:19 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan-sebastian.tuomi@aalto.fi> | 2016-07-18 19:20:19 +0300 |
| commit | d954ed175de1dab5bda8c198bc8d7e0b2c552d01 (patch) | |
| tree | 4063d6d7b8803ae9c50de8cbb60e5fef72632742 /mockshoutbox.py | |
| parent | e5dede846917747e688a4b6581da019712ca9b1d (diff) | |
Add buffer to avoid forwarding duplicate messages from shoutbox
Diffstat (limited to 'mockshoutbox.py')
| -rw-r--r-- | mockshoutbox.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mockshoutbox.py b/mockshoutbox.py index 6e6326e..da8e48a 100644 --- a/mockshoutbox.py +++ b/mockshoutbox.py @@ -6,6 +6,8 @@ import traceback from http.server import SimpleHTTPRequestHandler import json +import time + ''' Mock HTTP server to test shoutbox api requests. @@ -23,13 +25,13 @@ class MyHandler(SimpleHTTPRequestHandler): self.send_header("Content-type", "application/json") self.end_headers() - body = """[ - { - \"text\":\"test message\", - \"user\":\"test user\" - } - ]""" - + body = json.dumps([{ + "user": "test user", + "text": "test message", + "timestamp": str(time.time()), + "id": time.time(), + "ip": "1.2.3.4" + }]) self.wfile.write(body.encode()) def do_POST(self): |
