7 class WebsocketTest(run_test_server.TestCaseWithServers):
8 MAIN_SERVER = {'websockets': True}
10 def on_event(self, ev):
12 self.assertEqual(200, ev['status'])
15 self.assertEqual(self.h[u'uuid'], ev[u'object_uuid'])
23 run_test_server.authorize_with("admin")
24 api = arvados.api('v1', cache=False)
25 ws = arvados.events.subscribe(api, [['object_uuid', 'is_a', 'arvados#human']], lambda ev: self.on_event(ev))
27 self.h = api.humans().create(body={}).execute()
29 self.assertEqual(3, self.state)
32 class PollClientTest(run_test_server.TestCaseWithServers):
35 def on_event(self, ev):
37 self.assertEqual(200, ev['status'])
40 self.assertEqual(self.h[u'uuid'], ev[u'object_uuid'])
48 run_test_server.authorize_with("admin")
49 api = arvados.api('v1', cache=False)
50 ws = arvados.events.subscribe(api, [['object_uuid', 'is_a', 'arvados#human']], lambda ev: self.on_event(ev), poll_fallback=2)
52 self.h = api.humans().create(body={}).execute()
54 self.assertEqual(3, self.state)