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()) |