8 class WebsocketTest(run_test_server.TestCaseWithServers):
9 MAIN_SERVER = {'websockets': True}
11 def on_event(self, ev):
13 self.assertEqual(200, ev['status'])
16 self.assertEqual(self.h[u'uuid'], ev[u'object_uuid'])
24 self.done = threading.Event()
26 run_test_server.authorize_with("admin")
27 api = arvados.api('v1', cache=False)
28 ws = arvados.events.subscribe(api, [['object_uuid', 'is_a', 'arvados#human']], self.on_event)
30 self.h = api.humans().create(body={}).execute()
32 self.assertEqual(3, self.state)
35 class PollClientTest(run_test_server.TestCaseWithServers):
38 def on_event(self, ev):
40 self.assertEqual(200, ev['status'])
43 self.assertEqual(self.h[u'uuid'], ev[u'object_uuid'])
51 self.done = threading.Event()
53 run_test_server.authorize_with("admin")
54 api = arvados.api('v1', cache=False)
55 ws = arvados.events.subscribe(api, [['object_uuid', 'is_a', 'arvados#human']], self.on_event, poll_fallback=2)
57 self.h = api.humans().create(body={}).execute()
59 self.assertEqual(3, self.state)