def test_raise_invalid_port(self):

        app = build_app([TBadRPCPortService()], 'MisingPortTns',
                        'MissingPortApp')

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                          self.url)

        app = build_app(
            [TBadRPCPortService(), TSinglePortService()], 'MissingPort2Tns',
            'MissingPortApp')

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                          self.url)
Пример #2
0
    def test_default_binding(self):
        app = build_app([TDefaultPortService()], 'DefaultPortTest',
                        'DefaultBindingName')

        wrapper = AppTestWrapper(app)

        self._default_binding(wrapper, "DefaultBindingName", 1)
Пример #3
0
    def test_default_binding_multiple(self):
        app = build_app([TDefaultPortServiceMultipleMethods()],
                        'DefaultPortTest', 'MultipleDefaultBindingNameApp')

        wrapper = AppTestWrapper(app)

        self._default_binding(wrapper, 'MultipleDefaultBindingNameApp', 3)
Пример #4
0
    def test_default_port_type(self):
        # Test the default port is created
        # Test the default port has the correct name
        app = build_app([TDefaultPortService()], "DefaultPortTest", "DefaultPortName")

        wrapper = AppTestWrapper(app)
        self._default_port_type(wrapper, "DefaultPortName", 1)
Пример #5
0
    def test_default_port_type_multiple(self):
        app = build_app([TDefaultPortServiceMultipleMethods()],
                        'DefaultServiceTns', 'MultipleDefaultPortServiceApp')

        wrapper = AppTestWrapper(app)

        self._default_port_type(wrapper, "MultipleDefaultPortServiceApp", 3)
Пример #6
0
    def test_port_count(self):
        sa = build_app([TSinglePortService()], 'tns', name='SinglePortApp')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_wsdl_el = wsdl.root_elt

        self.assertEquals(1, len(sa_wsdl_el.findall(self.port_type_string)))
        pl = sa_wsdl_el.findall(self.port_type_string)
        self.assertEqual(1, len(pl))

        da = build_app([TDoublePortService()], 'tns', name='DoublePortApp')
        wsdl = Wsdl11(da.interface)
        wsdl.build_interface_document(self.url)

        from lxml import etree
        print(etree.tostring(wsdl.root_elt, pretty_print=True))
        self.assertEquals(2, len(wsdl.root_elt.findall(self.port_type_string)))
Пример #7
0
    def test_default_binding_methods(self):
        app = build_app([TDefaultPortService()], 'DefaultPortTest',
                        'DefaultPortMethods')

        wrapper = AppTestWrapper(app)

        self._default_binding_methods(wrapper, 1,
                                      ['echo_default_port_service'])
    def test_port_count(self):
        sa = build_app([TSinglePortService()], 'tns', name='SinglePortApp')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_wsdl_el = wsdl.root_elt

        self.assertEquals(1, len(sa_wsdl_el.findall(self.port_type_string)))
        pl = sa_wsdl_el.findall(self.port_type_string)
        self.assertEqual(1, len(pl))

        da = build_app([TDoublePortService()], 'tns', name='DoublePortApp')
        wsdl = Wsdl11(da.interface)
        wsdl.build_interface_document(self.url)

        from lxml import etree
        print(etree.tostring(wsdl.root_elt, pretty_print=True))
        self.assertEquals(2, len(wsdl.root_elt.findall(self.port_type_string)))
Пример #9
0
    def test_default_port_type(self):
        # Test the default port is created
        # Test the default port has the correct name
        app = build_app([TDefaultPortService()], 'DefaultPortTest',
                        'DefaultPortName')

        wrapper = AppTestWrapper(app)
        self._default_port_type(wrapper, 'DefaultPortName', 1)
    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([TMissingRPCPortService()], 'MisingPortTns',
                        'MissingPortApp')

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                          self.url)

        app = build_app([TSinglePortService(),
                         TMissingRPCPortService()], 'MissingPort2Tns',
                        'MissingPort2App')

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                          self.url)
    def test_tns(self):
        sa = build_app([TSinglePortService()], 'SinglePort', 'TestServiceName')

        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_el = wsdl.root_elt
        tns = sa_el.get('targetNamespace')
        self.assertEqual('SinglePort', tns)

        sa = build_app(
            [TSinglePortService(), TDoublePortService()], 'MultiServiceTns',
            'AppName')

        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        tns = wsdl.root_elt.get('targetNamespace')

        self.assertEqual(tns, 'MultiServiceTns')
    def test_port_name(self):
        sa = build_app([TSinglePortService()], 'tns', name='SinglePortApp')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_wsdl_el = wsdl.root_elt

        pl = sa_wsdl_el.findall(self.port_type_string)
        print(('\n', pl, pl[0].attrib))
        self.assertEqual('FirstPortType', pl[0].get('name'))

        da = build_app([TDoublePortService()], 'tns', name='DoublePortApp')

        wsdl = Wsdl11(da.interface)
        wsdl.build_interface_document(self.url)
        da_wsdl_el = wsdl.root_elt

        pl2 = da_wsdl_el.findall(self.port_type_string)
        self.assertEqual('FirstPort', pl2[0].get('name'))
        self.assertEqual('SecondPort', pl2[1].get('name'))
Пример #13
0
    def test_default_port_type_multiple(self):
        app = build_app(
                [TDefaultPortServiceMultipleMethods()],
                'DefaultServiceTns',
                'MultipleDefaultPortServiceApp'
                )

        wrapper = AppTestWrapper(app)

        self._default_port_type(wrapper, "MultipleDefaultPortServiceApp", 3)
Пример #14
0
    def test_default_binding_multiple(self):
        app = build_app(
                [TDefaultPortServiceMultipleMethods()],
                'DefaultPortTest',
                'MultipleDefaultBindingNameApp'
                )

        wrapper = AppTestWrapper(app)

        self._default_binding(wrapper, 'MultipleDefaultBindingNameApp', 3)
Пример #15
0
    def test_port_name(self):
        sa = build_app([TSinglePortService()], 'tns', name='SinglePortApp')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_wsdl_el = wsdl.root_elt

        pl = sa_wsdl_el.findall(self.port_type_string)
        print(('\n', pl, pl[0].attrib))
        self.assertEqual('FirstPortType', pl[0].get('name'))

        da = build_app([TDoublePortService()], 'tns', name='DoublePortApp')

        wsdl = Wsdl11(da.interface)
        wsdl.build_interface_document(self.url)
        da_wsdl_el = wsdl.root_elt

        pl2 = da_wsdl_el.findall(self.port_type_string)
        self.assertEqual('FirstPort', pl2[0].get('name'))
        self.assertEqual('SecondPort', pl2[1].get('name'))
Пример #16
0
    def test_default_binding(self):
        app = build_app(
                [TDefaultPortService()],
                'DefaultPortTest',
                'DefaultBindingName'
        )

        wrapper = AppTestWrapper(app)

        self._default_binding(wrapper, "DefaultBindingName", 1)
    def test_service_name(self):
        sa = build_app([TSinglePortService()], 'SinglePort', 'TestServiceName')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_el = wsdl.root_elt

        sl = [s for s in sa_el.iterfind(self.service_string)]
        name = sl[0].get('name')
        print((len(sl)))

        self.assertEqual('SinglePortService_ServiceInterface', name)
Пример #18
0
    def test_service_name(self):
        sa = build_app([TSinglePortService()], 'SinglePort', 'TestServiceName')
        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_el = wsdl.root_elt

        sl = [s for s in sa_el.iterfind(self.service_string)]
        name = sl[0].get('name')
        print((len(sl)))

        self.assertEqual('SinglePortService_ServiceInterface', name)
Пример #19
0
    def test_tns(self):
        sa = build_app([TSinglePortService()], 'SinglePort', 'TestServiceName')

        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        sa_el = wsdl.root_elt
        tns = sa_el.get('targetNamespace')
        self.assertEqual('SinglePort', tns)

        sa = build_app(
            [TSinglePortService(), TDoublePortService()],
            'MultiServiceTns',
            'AppName'
        )

        wsdl = Wsdl11(sa.interface)
        wsdl.build_interface_document(self.url)
        tns = wsdl.root_elt.get('targetNamespace')

        self.assertEqual(tns, 'MultiServiceTns')
Пример #20
0
    def test_raise_invalid_port(self):

        app = build_app(
            [TBadRPCPortService()],
            'MisingPortTns',
            'MissingPortApp'
        )

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                                                                       self.url)

        app = build_app(
            [TBadRPCPortService(), TSinglePortService()],
            'MissingPort2Tns',
            'MissingPortApp'
        )

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                                                                       self.url)
Пример #21
0
    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(
            [TMissingRPCPortService()],
            'MisingPortTns',
            'MissingPortApp'
        )

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                                                                       self.url)

        app = build_app(
            [TSinglePortService(), TMissingRPCPortService()],
            'MissingPort2Tns',
            'MissingPort2App'
        )

        interface_doc = Wsdl11(app.interface)
        self.assertRaises(ValueError, interface_doc.build_interface_document,
                                                                       self.url)
Пример #22
0
    def test_default_binding_methods(self):
        app = build_app(
            [TDefaultPortService()],
            'DefaultPortTest',
            'DefaultPortMethods'
        )

        wrapper = AppTestWrapper(app)

        self._default_binding_methods(
            wrapper,
            1,
            ['echo_default_port_service']
        )
Пример #23
0
    def test_default_binding_methods_multiple(self):
        app = build_app(
                [TDefaultPortServiceMultipleMethods()],
                '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([TSinglePortService()], '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'))
Пример #25
0
    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(
            [TSinglePortService()],
            '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'))
Пример #26
0
    def test_default_binding_methods(self):
        app = build_app([TDefaultPortService()], "DefaultPortTest", "DefaultPortMethods")

        wrapper = AppTestWrapper(app)

        self._default_binding_methods(wrapper, 1, ["echo_default_port_service"])