Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: testing/legion/examples/events/task.py

Issue 1585373003: Adding a cross-task eventing server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a return code for one of the server use cases. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/legion/examples/events/task.py
diff --git a/testing/legion/examples/events/task.py b/testing/legion/examples/events/task.py
new file mode 100755
index 0000000000000000000000000000000000000000..d7b2539ce6c6aff8eb5c63ca157d54691e951579
--- /dev/null
+++ b/testing/legion/examples/events/task.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""A simple client test module.
+
+This module is invoked by the host by calling the client controller's
+Subprocess RPC method. The name is passed in as a required argument on the
+command line.
+"""
+
+import argparse
+import httplib
+import os
+import sys
+
+
+def GetArgs():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--address')
+ parser.add_argument('--port', type=int)
+ return parser.parse_args()
+
+def Connect(verb, path):
+ args = GetArgs()
+ conn = httplib.HTTPConnection(args.address, args.port)
+ conn.request(verb, path)
+ resp = conn.getresponse()
+ return resp.status
+
+def testSettingGettingAndClearingAnEvent():
+ assert Connect('GET', '/events/event1') == 404
M-A Ruel 2016/01/15 14:07:13 That test is a bit inscrutable.
Mike Meade 2016/01/18 20:25:51 Done.
+ assert Connect('POST', '/events/event1') == 200
M-A Ruel 2016/01/15 14:07:13 In the doc, you said PUT, not POST.
Mike Meade 2016/01/18 20:25:51 Done.
+ assert Connect('GET', '/events/event1') == 200
+ assert Connect('DELETE', '/events/event1') == 200
+ assert Connect('DELETE', '/events/event1') == 404
+ assert Connect('GET', '/events/event1') == 404
+
+def main():
+ testSettingGettingAndClearingAnEvent()
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698