def test_method(self):
            msg1 = "hello"
            msg2 = " world"
            exc_msg = "Haw haw! (with Nelson's voice)"
            methods = ('method1', 'method2')

            class Fake:
                def __init__(self):
                    self._parent = self

                def do_method1(self, arg1):
                    return arg1 + msg2

                def do_method2(self, arg1):
                    raise ArithmeticError(exc_msg)

            fake = Fake()

            newfunctions = []
            for i in methods:
                newfunction = ServerSOAP._generate_skeleton(i)
                newfunctions.append(newfunction)

            if ServerSOAP.SERIALIZE:
                #TODO: this must be tested
                return
            self.assertEquals(msg1 + msg2, newfunctions[0](fake, msg1))
            self.assertRaises(SOAPpy.faultType, newfunctions[1], fake, msg1)
            the_fault = None
            try:
                newfunctions[1](fake, msg1)
            except SOAPpy.faultType as ft:
                the_fault = ft

            self.assertEquals(the_fault.faultstring, exc_msg)
            self.assertEquals(the_fault.faultcode,
                              'exceptions.ArithmeticError')
        def test_method(self):
            msg1 = "hello"
            msg2 = " world"
            exc_msg = "Haw haw! (with Nelson's voice)"
            methods = ('method1','method2')
            class Fake:
                def __init__(self):
                    self._parent = self
                def do_method1(self,arg1):
                    return arg1 + msg2
                def do_method2(self,arg1):
                    raise ArithmeticError(exc_msg)
            fake = Fake()

            newfunctions = []
            for i in methods:
                newfunction = ServerSOAP._generate_skeleton(i)
                newfunctions.append(newfunction)

            if ServerSOAP.SERIALIZE:
                #TODO: this must be tested
                return
            self.assertEquals(msg1 + msg2,newfunctions[0](fake,msg1))
            self.assertRaises(
                    SOAPpy.faultType,
                    newfunctions[1],
                    fake,
                    msg1
                )
            the_fault = None
            try:
                newfunctions[1](fake,msg1)
            except SOAPpy.faultType as ft:
                the_fault = ft

            self.assertEquals( the_fault.faultstring, exc_msg )
            self.assertEquals( the_fault.faultcode, 'exceptions.ArithmeticError' )
 def func():
     ServerClass = ServerSOAP.generate(None, ['method1', 'method2'])
     ServerClass('', 10464)
 def func():
     ServerClass = ServerSOAP.generate(None, ['method1','method2'])
     ServerClass('', 10464)