def test_raise_invalid_port(self): app = build_app([BadRPCPortService], 'MisingPortTns', 'MissingPortApp') self.assertRaises(ValueError, app.get_wsdl, self.url) app = build_app([BadRPCPortService, SinglePortService], 'MissingPort2Tns', 'MissingPortApp') self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_raise_no_service_port(self): app = build_app([MissingServicePortService], 'MisingPortTns', 'MissingPortApp') self.assertRaises(ValueError, app.get_wsdl, self.url) app = build_app([SinglePortService, MissingServicePortService], 'MissingServicePort2Tns', 'MissingServicePort2App') self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_raise_missing_port(self): # Test that an exception is raised when a port is declared in the service class # but the rpc method does not declare a port. app = build_app([MissingRPCPortService], 'MisingPortTns', 'MissingPortApp') self.assertRaises(ValueError, app.get_wsdl, self.url) app = build_app([SinglePortService, MissingRPCPortService], 'MissingPort2Tns', 'MissingPort2App') self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_tns(self): sa = build_app([SinglePortService], 'SinglePort', 'TestServiceName') sa.get_wsdl(self.url) sa_el = sa.wsdl.elements tns = sa_el.get('targetNamespace') self.assertEqual('SinglePort', tns) sa = build_app([SinglePortService, DoublePortService], 'MultiServiceTns', 'AppName') sa.get_wsdl(self.url) tns = sa.wsdl.elements.get('targetNamespace') self.assertEqual(tns, 'MultiServiceTns')
def test_port_name(self): sa = build_app([SinglePortService], 'tns', name='SinglePortApp') sa_wsdl_string = sa.get_wsdl(self.url) sa_wsdl_el = sa.wsdl.elements pl = [el for el in sa_wsdl_el.iterfind(self.port_type_string)] self.assertEqual('FirstPortType', pl[0].get('name')) da = build_app([DoublePortService], 'tns', name='DoublePortApp') da_wsdl_string = da.get_wsdl(self.url) da_wsdl_el = da.wsdl.elements pl2 = [el for el in da_wsdl_el.iterfind(self.port_type_string)] self.assertEqual('FirstPort', pl2[0].get('name')) self.assertEqual('SecondPort', pl2[1].get('name'))
def test_default_service(self): single_app = build_app([DefaultPortService], 'DefaultServiceTns', 'DefaultPortServiceApp') single_wrapper = AppTestWrapper(single_app) self._default_service(single_wrapper, "DefaultPortServiceApp")
def test_raise_no_service_port(self): app = build_app( [MissingServicePortService], 'MisingPortTns', 'MissingPortApp' ) self.assertRaises(ValueError,app.get_wsdl, self.url) app = build_app( [SinglePortService, MissingServicePortService], 'MissingServicePort2Tns', 'MissingServicePort2App' ) self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_raise_invalid_port(self): app = build_app( [BadRPCPortService], 'MisingPortTns', 'MissingPortApp' ) self.assertRaises(ValueError,app.get_wsdl, self.url) app = build_app( [BadRPCPortService, SinglePortService], 'MissingPort2Tns', 'MissingPortApp' ) self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_default_binding(self): app = build_app([DefaultPortService], 'DefaultPortTest', 'DefaultBindingName') wrapper = AppTestWrapper(app) self._default_binding(wrapper, "DefaultBindingName", 1)
def test_default_binding_multiple(self): app = build_app([DefaultPortServiceMultipleMethods], 'DefaultPortTest', 'MultipleDefaultBindingNameApp') wrapper = AppTestWrapper(app) self._default_binding(wrapper, 'MultipleDefaultBindingNameApp', 3)
def test_default_port_type_multiple(self): app = build_app([DefaultPortServiceMultipleMethods], 'DefaultServiceTns', 'MultipleDefaultPortServiceApp') wrapper = AppTestWrapper(app) self._default_port_type(wrapper, "MultipleDefaultPortServiceApp", 3)
def test_service_name(self): sa = build_app([SinglePortService], 'SinglePort', 'TestServiceName') sa_wsdl = sa.get_wsdl(self.url) sa_el = sa.wsdl.elements sl = [s for s in sa_el.iterfind(self.service_string)] name = sl[0].get('name') self.assertEqual('SinglePortService_ServiceInterface', name)
def test_default_service_multiple_methods(self): triple_app = build_app( [DefaultPortServiceMultipleMethods], 'DefaultServiceTns', 'DefaultPortServiceApp' ) triple_wrapper = AppTestWrapper(triple_app) self._default_service(triple_wrapper, "DefaultPortServiceApp")
def test_default_binding_methods_multiple(self): app = build_app([DefaultPortServiceMultipleMethods], 'DefaultBindingMethodsTns', 'MultipleDefaultBindMethodsApp') wrapper = AppTestWrapper(app) self._default_binding_methods(wrapper, 3, ['echo_one', 'echo_two', 'echo_three'])
def test_default_binding_methods(self): app = build_app([DefaultPortService], 'DefaultPortTest', 'DefaultPortMethods') wrapper = AppTestWrapper(app) self._default_binding_methods(wrapper, 1, ['echo_default_port_service'])
def test_tns(self): sa = build_app([SinglePortService], 'SinglePort', 'TestServiceName') sa.get_wsdl(self.url) sa_el = sa.wsdl.elements tns = sa_el.get('targetNamespace') self.assertEqual('SinglePort', tns) sa = build_app( [SinglePortService, DoublePortService], 'MultiServiceTns', 'AppName' ) sa.get_wsdl(self.url) tns = sa.wsdl.elements.get('targetNamespace') self.assertEqual(tns, 'MultiServiceTns')
def test_default_service(self): single_app = build_app( [DefaultPortService], 'DefaultServiceTns', 'DefaultPortServiceApp' ) single_wrapper = AppTestWrapper(single_app) self._default_service(single_wrapper, "DefaultPortServiceApp")
def test_default_port_type(self): # Test the default port is created # Test the default port has the correct name app = build_app([DefaultPortService], 'DefaultPortTest', 'DefaultPortName') wrapper = AppTestWrapper(app) self._default_port_type(wrapper, 'DefaultPortName', 1)
def test_service_name(self): sa = build_app([SinglePortService], 'SinglePort', 'TestServiceName') sa_wsdl = sa.get_wsdl(self.url) sa_el = sa.wsdl.elements sl = [s for s in sa_el.iterfind(self.service_string)] name = sl[0].get('name') print len(sl) self.assertEqual('SinglePortService_ServiceInterface', name)
def test_default_binding_multiple(self): app = build_app( [DefaultPortServiceMultipleMethods], 'DefaultPortTest', 'MultipleDefaultBindingNameApp' ) wrapper = AppTestWrapper(app) self._default_binding(wrapper, 'MultipleDefaultBindingNameApp', 3)
def test_default_binding(self): app = build_app( [DefaultPortService], 'DefaultPortTest', 'DefaultBindingName' ) wrapper = AppTestWrapper(app) self._default_binding(wrapper, "DefaultBindingName", 1)
def test_default_port_type_multiple(self): app = build_app( [DefaultPortServiceMultipleMethods], 'DefaultServiceTns', 'MultipleDefaultPortServiceApp' ) wrapper = AppTestWrapper(app) self._default_port_type(wrapper, "MultipleDefaultPortServiceApp", 3)
def test_raise_missing_port(self): # Test that an exception is raised when a port is declared in the service class # but the rpc method does not declare a port. app = build_app( [MissingRPCPortService], 'MisingPortTns', 'MissingPortApp' ) self.assertRaises(ValueError, app.get_wsdl, self.url) app = build_app( [SinglePortService, MissingRPCPortService], 'MissingPort2Tns', 'MissingPort2App' ) self.assertRaises(ValueError, app.get_wsdl, self.url)
def test_port_count(self): sa = build_app([SinglePortService], 'tns', name='SinglePortApp') sa_wsdl_string = sa.get_wsdl(self.url) sa_wsdl_el = sa.wsdl.elements sa_wsdl_type = sa.wsdl self.assertEquals(1, len(sa_wsdl_type.port_type_dict.keys())) pl = [el for el in sa_wsdl_el.iterfind(self.port_type_string)] self.assertEqual(1, len(pl)) da = build_app([DoublePortService], 'tns', name='DoublePortApp') da_wsdl_string = da.get_wsdl(self.url) da_wsdl_el = da.wsdl.elements da_wsdl_type = da.wsdl self.assertEquals(2, len(da_wsdl_type.port_type_dict.keys())) pl2 = [el for el in da_wsdl_el.iterfind(self.port_type_string)] self.assertEqual(2, len(pl2))
def test_default_port_type(self): # Test the default port is created # Test the default port has the correct name app = build_app( [DefaultPortService], 'DefaultPortTest', 'DefaultPortName' ) wrapper = AppTestWrapper(app) self._default_port_type(wrapper, 'DefaultPortName', 1)
def test_default_binding_methods(self): app = build_app( [DefaultPortService], 'DefaultPortTest', 'DefaultPortMethods' ) wrapper = AppTestWrapper(app) self._default_binding_methods( wrapper, 1, ['echo_default_port_service'] )
def test_default_binding_methods_multiple(self): app = build_app( [DefaultPortServiceMultipleMethods], 'DefaultBindingMethodsTns', 'MultipleDefaultBindMethodsApp' ) wrapper = AppTestWrapper(app) self._default_binding_methods( wrapper, 3, ['echo_one', 'echo_two', 'echo_three'] )
def test_service_contains_ports(self): # Check that the element for the service has the correct number of ports # Check that the element for the service has the correct port names app = build_app([SinglePortService], 'SinglePortTns', 'SinglePortApp') wrapper = AppTestWrapper(app) service = wrapper.get_service_list()[0] # verify that there is only one port ports = wrapper.get_port_list(service) self.assertEquals(1, len(ports)) # verify that the ports name matched the port specified in # the service class port = ports[0] self.assertEquals('FirstPortType', port.get('name'))
def test_service_contains_ports(self): # Check that the element for the service has the correct number of ports # Check that the element for the service has the correct port names app = build_app( [SinglePortService], 'SinglePortTns', 'SinglePortApp' ) wrapper = AppTestWrapper(app) service = wrapper.get_service_list()[0] # verify that there is only one port ports = wrapper.get_port_list(service) self.assertEquals(1, len(ports)) # verify that the ports name matched the port specified in # the service class port = ports[0] self.assertEquals('FirstPortType', port.get('name'))
def test_default_service_multiple_methods(self): triple_app = build_app([DefaultPortServiceMultipleMethods], 'DefaultServiceTns', 'DefaultPortServiceApp') triple_wrapper = AppTestWrapper(triple_app) self._default_service(triple_wrapper, "DefaultPortServiceApp")