def test_multiple_process_pre_conditions(self): hello1 = self.container.spawn_process('hello_service1','ion.service.examples.hello_service','HelloService' ) self.addCleanup(self.container.terminate_process, hello1) hello2 = self.container.spawn_process('hello_service2','ion.service.examples.hello_service','HelloService' ) self.addCleanup(self.container.terminate_process, hello2) hello3 = self.container.spawn_process('hello_service3','ion.service.examples.hello_service','HelloService' ) #self.addCleanup(self.container.terminate_process, hello3) client = HelloServiceProcessClient(process=self.gov_client) actor_id='anonymous' text='mytext 123' actor_headers = get_actor_header(actor_id) ret = client.hello(text, headers=actor_headers) self.assertIn(text, ret) with self.assertRaises(Unauthorized) as cm: ret = client.noop(text=text) self.assertIn('The noop operation has been denied', cm.exception.message) self.container.terminate_process(hello3) with self.assertRaises(Unauthorized) as cm: ret = client.noop(text=text) self.assertIn('The noop operation has been denied', cm.exception.message)
def hello_noop(container, actor_id='anonymous', text='mytext 123'): try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) actor_headers = get_actor_header(actor_id) ret = client.noop(text, headers=actor_headers) except Exception, e: print "client.hello() failed: " + e.message
def hello_noop(container, actor_id='anonymous', text='mytext 123'): try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) actor_headers = get_actor_header(actor_id) ret = client.noop(text, headers=actor_headers) except Exception ,e: print "client.hello() failed: " + e.message
def hello_client(container, actor_id='anonymous', text='mytext 123'): try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) actor_headers = get_actor_header(actor_id) ret = client.hello(text, headers=actor_headers) print "Returned: " + str(ret) ret = client.hello('second message text', headers=actor_headers) print "Returned: " + str(ret) ret = client.noop(text='third message text', headers=actor_headers) print "Returned" except Exception as e: print "client.hello() failed: " + e.message
def test_multiple_process_pre_conditions(self): hello1 = self.container.spawn_process( 'hello_service1', 'ion.service.examples.hello_service', 'HelloService') self.addCleanup(self.container.terminate_process, hello1) hello2 = self.container.spawn_process( 'hello_service2', 'ion.service.examples.hello_service', 'HelloService') self.addCleanup(self.container.terminate_process, hello2) hello3 = self.container.spawn_process( 'hello_service3', 'ion.service.examples.hello_service', 'HelloService') #self.addCleanup(self.container.terminate_process, hello3) client = HelloServiceProcessClient(process=self.gov_client) actor_id = 'anonymous' text = 'mytext 123' actor_headers = get_actor_header(actor_id) ret = client.hello(text, headers=actor_headers) self.assertIn(text, ret) with self.assertRaises(Unauthorized) as cm: ret = client.noop(text=text) self.assertIn('The noop operation has been denied', cm.exception.message) self.container.terminate_process(hello3) with self.assertRaises(Unauthorized) as cm: ret = client.noop(text=text) self.assertIn('The noop operation has been denied', cm.exception.message)