s4:ldb Add test for integer normalisation behaviour
authorAndrew Bartlett <abartlet@samba.org>
Fri, 19 Jun 2009 01:29:31 +0000 (11:29 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 19 Jun 2009 01:32:01 +0000 (11:32 +1000)
This uses groupType as the example, but this actually applies to all
integer types in AD.

Andrew Bartlett

source4/lib/ldb/tests/python/ldap.py

index caa1c477d3bcedaf21c8b6f19c47030332200af6..5418cc9d60a3d0aca53aca7558678258ae45c94a 100755 (executable)
@@ -124,6 +124,23 @@ class BasicTests(unittest.TestCase):
         ldb.delete("cn=parentguidtest,cn=testotherusers," + self.base_dn)
         ldb.delete("cn=testotherusers," + self.base_dn)
 
+    def test_groupType(self):
+        """Test groupType behaviour 
+        (should appear to be casted to a 32 bit signed integer before comparsion)"""
+        print "Testing groupType behaviour\n"
+        
+        res1 = ldb.search(base=self.base_dn, scope=SCOPE_SUBTREE,
+                          attrs=["groupType"], expression="groupType=2147483650");
+
+        res2 = ldb.search(base=self.base_dn, scope=SCOPE_SUBTREE,
+                          attrs=["groupType"], expression="groupType=-2147483646");
+
+        self.assertEquals(len(res1), len(res2))
+
+        self.assertTrue(res1.count > 0)
+
+        self.assertEquals(res1[0]["groupType"][0], "-2147483646")
+
     def test_all(self):
         """Basic tests"""