def test_multiple_process_pre_conditions(self): hello1 = self.container.spawn_process('hello_service1','examples.service.hello_service','HelloService' ) self.addCleanup(self.container.terminate_process, hello1) hello2 = self.container.spawn_process('hello_service2','examples.service.hello_service','HelloService' ) self.addCleanup(self.container.terminate_process, hello2) hello3 = self.container.spawn_process('hello_service3','examples.service.hello_service','HelloService' ) #self.addCleanup(self.container.terminate_process, hello3) client = HelloServiceProcessClient(node=self.container.node, 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', org_id='no-ooi', text='mytext 123'): try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) ret = client.noop(text, headers={'ion-actor-id': actor_id, 'ion-org-id': org_id}) 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', org_id='no-ooi', text='mytext 123'): # client = ProcessRPCClient(node=container.node, name="hello", iface=IHelloService, process=FakeProcess()) try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) ret = client.hello(text, headers={'ion-actor-id': actor_id, 'ion-org-id': org_id}) print "Returned: " + str(ret) 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 = container.governance_controller.build_actor_header(actor_id) ret = client.hello(text) print "Returned: " + str(ret) ret = client.hello('second message text') print "Returned: " + str(ret) 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 = container.governance_controller.build_actor_header( actor_id) ret = client.hello(text) print "Returned: " + str(ret) ret = client.hello('second message text') print "Returned: " + str(ret) except Exception, e: print "client.hello() failed: " + e.message
def hello_noop(container, actor_id='anonymous', org_id='no-ooi', text='mytext 123'): try: client = HelloServiceProcessClient(node=container.node, process=FakeProcess()) ret = client.noop(text, headers={ 'ion-actor-id': actor_id, 'ion-org-id': org_id }) 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, e: print "client.hello() failed: " + e.message