Back to index

python3.2  3.2.2
Public Member Functions
test.test_xmlrpc.XMLRPCTestCase Class Reference

List of all members.

Public Member Functions

def test_dump_load
def test_dump_bare_datetime
def test_datetime_before_1900
def test_cmp_datetime_DateTime
def test_bug_1164912
def test_newstyle_class
def test_dump_big_long
def test_dump_bad_dict
def test_dump_recursive_seq
def test_dump_recursive_dict
def test_dump_big_int
def test_dump_none
def test_get_host_info
def test_ssl_presence

Detailed Description

Definition at line 37 of file test_xmlrpc.py.


Member Function Documentation

Definition at line 78 of file test_xmlrpc.py.

00078 
00079     def test_bug_1164912 (self):
00080         d = xmlrpclib.DateTime()
00081         ((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,),
00082                                             methodresponse=True))
00083         self.assertIsInstance(new_d.value, str)
00084 
00085         # Check that the output of dumps() is still an 8-bit string
00086         s = xmlrpclib.dumps((new_d,), methodresponse=True)
00087         self.assertIsInstance(s, str)

Here is the call graph for this function:

Definition at line 69 of file test_xmlrpc.py.

00069 
00070     def test_cmp_datetime_DateTime(self):
00071         now = datetime.datetime.now()
00072         dt = xmlrpclib.DateTime(now.timetuple())
00073         self.assertTrue(dt == now)
00074         self.assertTrue(now == dt)
00075         then = now + datetime.timedelta(seconds=4)
00076         self.assertTrue(then >= dt)
00077         self.assertTrue(dt < then)

Here is the call graph for this function:

Definition at line 58 of file test_xmlrpc.py.

00058 
00059     def test_datetime_before_1900(self):
00060         # same as before but with a date before 1900
00061         dt = datetime.datetime(1,  2, 10, 11, 41, 23)
00062         s = xmlrpclib.dumps((dt,))
00063         (newdt,), m = xmlrpclib.loads(s, use_datetime=1)
00064         self.assertEqual(newdt, dt)
00065         self.assertEqual(m, None)
00066 
00067         (newdt,), m = xmlrpclib.loads(s, use_datetime=0)
00068         self.assertEqual(newdt, xmlrpclib.DateTime('00010210T11:41:23'))

Here is the call graph for this function:

Definition at line 100 of file test_xmlrpc.py.

00100 
00101     def test_dump_bad_dict(self):
00102         self.assertRaises(TypeError, xmlrpclib.dumps, ({(1,2,3): 1},))

Here is the call graph for this function:

Definition at line 44 of file test_xmlrpc.py.

00044 
00045     def test_dump_bare_datetime(self):
00046         # This checks that an unwrapped datetime.date object can be handled
00047         # by the marshalling code.  This can't be done via test_dump_load()
00048         # since with use_datetime set to 1 the unmarshaller would create
00049         # datetime objects for the 'datetime[123]' keys as well
00050         dt = datetime.datetime(2005, 2, 10, 11, 41, 23)
00051         s = xmlrpclib.dumps((dt,))
00052         (newdt,), m = xmlrpclib.loads(s, use_datetime=1)
00053         self.assertEqual(newdt, dt)
00054         self.assertEqual(m, None)
00055 
00056         (newdt,), m = xmlrpclib.loads(s, use_datetime=0)
00057         self.assertEqual(newdt, xmlrpclib.DateTime('20050210T11:41:23'))

Here is the call graph for this function:

Definition at line 115 of file test_xmlrpc.py.

00115 
00116     def test_dump_big_int(self):
00117         if sys.maxsize > 2**31-1:
00118             self.assertRaises(OverflowError, xmlrpclib.dumps,
00119                               (int(2**34),))
00120 
00121         xmlrpclib.dumps((xmlrpclib.MAXINT, xmlrpclib.MININT))
00122         self.assertRaises(OverflowError, xmlrpclib.dumps,
00123                           (xmlrpclib.MAXINT+1,))
00124         self.assertRaises(OverflowError, xmlrpclib.dumps,
00125                           (xmlrpclib.MININT-1,))
00126 
00127         def dummy_write(s):
00128             pass
00129 
00130         m = xmlrpclib.Marshaller()
00131         m.dump_int(xmlrpclib.MAXINT, dummy_write)
00132         m.dump_int(xmlrpclib.MININT, dummy_write)
00133         self.assertRaises(OverflowError, m.dump_int,
00134                           xmlrpclib.MAXINT+1, dummy_write)
00135         self.assertRaises(OverflowError, m.dump_int,
00136                           xmlrpclib.MININT-1, dummy_write)

Here is the call graph for this function:

Definition at line 97 of file test_xmlrpc.py.

00097 
00098     def test_dump_big_long(self):
00099         self.assertRaises(OverflowError, xmlrpclib.dumps, (2**99,))

Here is the call graph for this function:

Definition at line 39 of file test_xmlrpc.py.

00039 
00040     def test_dump_load(self):
00041         dump = xmlrpclib.dumps((alist,))
00042         load = xmlrpclib.loads(dump)
00043         self.assertEqual(alist, load[0][0])

Here is the call graph for this function:

Definition at line 137 of file test_xmlrpc.py.

00137 
00138     def test_dump_none(self):
00139         value = alist + [None]
00140         arg1 = (alist + [None],)
00141         strg = xmlrpclib.dumps(arg1, allow_none=True)
00142         self.assertEqual(value,
00143                           xmlrpclib.loads(strg)[0][0])
00144         self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,))

Here is the call graph for this function:

Definition at line 109 of file test_xmlrpc.py.

00109 
00110     def test_dump_recursive_dict(self):
00111         d = {'1':1, '2':1}
00112         t = {'3':3, 'd':d}
00113         d['t'] = t
00114         self.assertRaises(TypeError, xmlrpclib.dumps, (d,))

Here is the call graph for this function:

Definition at line 103 of file test_xmlrpc.py.

00103 
00104     def test_dump_recursive_seq(self):
00105         l = [1,2,3]
00106         t = [3,4,5,l]
00107         l.append(t)
00108         self.assertRaises(TypeError, xmlrpclib.dumps, (l,))

Here is the call graph for this function:

Definition at line 145 of file test_xmlrpc.py.

00145 
00146     def test_get_host_info(self):
00147         # see bug #3613, this raised a TypeError
00148         transp = xmlrpc.client.Transport()
00149         self.assertEqual(transp.get_host_info("user@host.tld"),
00150                           ('host.tld',
00151                            [('Authorization', 'Basic dXNlcg==')], {}))

Here is the call graph for this function:

Definition at line 88 of file test_xmlrpc.py.

00088 
00089     def test_newstyle_class(self):
00090         class T(object):
00091             pass
00092         t = T()
00093         t.x = 100
00094         t.y = "Hello"
00095         ((t2,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((t,)))
00096         self.assertEqual(t2, t.__dict__)

Definition at line 152 of file test_xmlrpc.py.

00152 
00153     def test_ssl_presence(self):
00154         try:
00155             import ssl
00156         except ImportError:
00157             has_ssl = False
00158         else:
00159             has_ssl = True
00160         try:
00161             xmlrpc.client.ServerProxy('https://localhost:9999').bad_function()
00162         except NotImplementedError:
00163             self.assertFalse(has_ssl, "xmlrpc client's error with SSL support")
00164         except socket.error:
00165             self.assertTrue(has_ssl)

Here is the call graph for this function:


The documentation for this class was generated from the following file: