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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """A simple client test module.
7
8 This module is invoked by the host by calling the client controller's
9 Subprocess RPC method. The name is passed in as a required argument on the
10 command line.
11 """
12
13 import argparse
14 import httplib
15 import os
16 import sys
17
18
19 def GetArgs():
20 parser = argparse.ArgumentParser()
21 parser.add_argument('--address')
22 parser.add_argument('--port', type=int)
23 return parser.parse_args()
24
25 def Connect(verb, path):
26 args = GetArgs()
27 conn = httplib.HTTPConnection(args.address, args.port)
28 conn.request(verb, path)
29 resp = conn.getresponse()
30 return resp.status
31
32 def testSettingGettingAndClearingAnEvent():
33 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.
34 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.
35 assert Connect('GET', '/events/event1') == 200
36 assert Connect('DELETE', '/events/event1') == 200
37 assert Connect('DELETE', '/events/event1') == 404
38 assert Connect('GET', '/events/event1') == 404
39
40 def main():
41 testSettingGettingAndClearingAnEvent()
42 return 0
43
44
45 if __name__ == '__main__':
46 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698