s4 python: Add unit tests related to PyLong/PyInt handling
authorMatthieu Patou <mat@matws.net>
Mon, 21 Jun 2010 20:58:48 +0000 (00:58 +0400)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 25 Jun 2010 09:33:33 +0000 (11:33 +0200)
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
source4/scripting/python/samba/tests/dcerpc/unix.py

index bd1fd6d95f6a8227b7e3ff3ee6dd0167ed20ccdc..4e1fe65ec5cb5c947130477d7285a56cc86b43c3 100644 (file)
@@ -26,14 +26,23 @@ class UnixinfoTests(RpcInterfaceTestCase):
         super(UnixinfoTests, self).setUp()
         self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
 
-    def test_getpwuid(self):
+    def test_getpwuid_int(self):
         infos = self.conn.GetPWUid(range(512))
         self.assertEquals(512, len(infos))
         self.assertEquals("/bin/false", infos[0].shell)
         self.assertTrue(isinstance(infos[0].homedir, unicode))
 
+    def test_getpwuid(self):
+        infos = self.conn.GetPWUid(map(long, range(512)))
+        self.assertEquals(512, len(infos))
+        self.assertEquals("/bin/false", infos[0].shell)
+        self.assertTrue(isinstance(infos[0].homedir, unicode))
+
     def test_gidtosid(self):
-        self.conn.GidToSid(1000)
+        self.conn.GidToSid(1000L)
 
     def test_uidtosid(self):
         self.conn.UidToSid(1000)
+    
+    def test_uidtosid_fail(self):
+        self.assertRaises(TypeError, self.conn.UidToSid, "100")