[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Thu Nov 18 08:14:00 MST 2010


What is if I simply revert my patch - since I've written also the other 
test in "sam.py"?

Greets,
Matthias

Jelmer Vernooij wrote:
> Hi Matthias,
>
> On Thu, 2010-11-18 at 12:33 +0100, Matthias Dieter Wallnöfer wrote:
>    
>> sorry. Are these tests so problematic to not keep them in "api.py"? I
>> thought it would be the right place. But if it's really not then please
>> point me to the right file.
>>      
> Yes, please. api.py isn't a generic testsuite for LDB. It's /just/ there
> to ensure that the python bindings work correctly. In other words, it
> tests pyldb.c, not common/*.c (see also the comment in the head of the
> file).
>
> The tests for LDB itself are written in shell and live in
> lib/ldb/tests/*.sh. Your DN tests are probably most appropriate in
> lib/ldb/tests/test-generic.sh.
>
> I could see the argument for doing a fair chunk of the the LDB testsuite
> in Python instead of in shell. However, that's a decision that would
> have to be made in discussion with LDB maintainers. And such tests
> should not be mixed with the tests for pyldb.
>
> Cheers,
>
> Jelmer
>
>    
>> Jelmer Vernooij wrote:
>>      
>>> Hi Matthias,
>>>
>>> On Thu, 2010-11-18 at 11:44 +0100, Matthias Dieter Wallnöfer wrote:
>>>
>>>        
>>>> commit 732ef9353dff56384e8bb01aa20d2a371cd995c2
>>>> Author: Matthias Dieter Wallnöfer<mdw at samba.org>
>>>> Date:   Thu Nov 18 09:22:07 2010 +0100
>>>>
>>>>       s4:api.py - DN tests - test a bit more special DNs and merge the comparison tests
>>>>
>>>>          
>>> Thanks for adding more tests.
>>>
>>> However, api.py is intended to just test that the Python bindings do the
>>> right things (hence the name), it's not meant as an overall testsuite
>>> for LDB itself. The testsuite for LDB itself lives in lib/ldb/tests. Can
>>> move these changes out of api.py to the tests there ?
>>>
>>> Also, there is a good reason we have so many small tests rather than
>>> bigger ones, please don't merge them. This makes it possible to spot
>>> what exactly is broken rather than knowing that "something" is broken.
>>>
>>> Cheers,
>>>
>>> Jelmer
>>>
>>>
>>>
>>>        
>>>> diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
>>>> index b8adbaa..efb9791 100755
>>>> --- a/source4/lib/ldb/tests/python/api.py
>>>> +++ b/source4/lib/ldb/tests/python/api.py
>>>> @@ -342,49 +342,74 @@ class DnTests(unittest.TestCase):
>>>>            x = ldb.Dn(self.ldb, "dc=foo11,bar=bloe")
>>>>            y = ldb.Dn(self.ldb, "dc=foo11,bar=bloe")
>>>>            self.assertEquals(x, y)
>>>> +        y = ldb.Dn(self.ldb, "dc=foo11,bar=blie")
>>>> +        self.assertNotEquals(x, y)
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        y = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(x, y)
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        y = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals(x, y)
>>>>
>>>>        def test_str(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo12,bar=bloe")
>>>>            self.assertEquals(x.__str__(), "dc=foo12,bar=bloe")
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(x.__str__(), "")
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals(x.__str__(), "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>>
>>>>        def test_repr(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo13,bla=blie")
>>>>            self.assertEquals(x.__repr__(), "Dn('dc=foo13,bla=blie')")
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(x.__repr__(), "Dn('')")
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals(x.__repr__(), "Dn('cn=foo\\\\, bar\\\\, bar,dc=test,dc=bloe')")
>>>>
>>>>        def test_get_casefold(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo14,bar=bloe")
>>>>            self.assertEquals(x.get_casefold(), "DC=FOO14,BAR=bloe")
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(x.get_casefold(), "")
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals(x.get_casefold(), "CN=FOO\, BAR\, BAR,DC=TEST,DC=BLOE")
>>>>
>>>>        def test_validate(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo15,bar=bloe")
>>>>            self.assertTrue(x.validate())
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertTrue(x.validate()) # the empty DN is valid (rootDSE)
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertTrue(x.validate())
>>>>
>>>>        def test_parent(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo16,bar=bloe")
>>>>            self.assertEquals("bar=bloe", x.parent().__str__())
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals("dc=test,dc=bloe", x.parent().__str__())
>>>>
>>>>        def test_parent_nonexistant(self):
>>>>            x = ldb.Dn(self.ldb, "@BLA")
>>>>            self.assertEquals(None, x.parent())
>>>> -
>>>> -    def test_compare(self):
>>>> -        x = ldb.Dn(self.ldb, "dc=foo17,bar=bloe")
>>>> -        y = ldb.Dn(self.ldb, "dc=foo17,bar=bloe")
>>>> -        self.assertEquals(x, y)
>>>> -        z = ldb.Dn(self.ldb, "dc=foo17,bar=blie")
>>>> -        self.assertNotEquals(z, y)
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(None, x.parent())
>>>>
>>>>        def test_is_valid(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo18,dc=bloe")
>>>>            self.assertTrue(x.is_valid())
>>>>            x = ldb.Dn(self.ldb, "")
>>>> -        # is_valid()'s return values appears to be a side effect of
>>>> -        # some other ldb functions. yuck.
>>>> -        # self.assertFalse(x.is_valid())
>>>> +        self.assertTrue(x.is_valid()) # the empty DN is valid (rootDSE)
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertTrue(x.is_valid())
>>>>
>>>>        def test_is_special(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo19,bar=bloe")
>>>>            self.assertFalse(x.is_special())
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertFalse(x.is_special())
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertFalse(x.is_special())
>>>>            x = ldb.Dn(self.ldb, "@FOOBAR")
>>>>            self.assertTrue(x.is_special())
>>>>
>>>> @@ -399,6 +424,10 @@ class DnTests(unittest.TestCase):
>>>>            self.assertEquals(2, len(x))
>>>>            x = ldb.Dn(self.ldb, "dc=foo21")
>>>>            self.assertEquals(1, len(x))
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals(0, len(x)) # the empty DN has length 0
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals(3, len(x))
>>>>
>>>>        def test_add_child(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo22,bar=bloe")
>>>> @@ -434,11 +463,18 @@ class DnTests(unittest.TestCase):
>>>>        def test_canonical_string(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo25,bar=bloe")
>>>>            self.assertEquals("/bloe/foo25", x.canonical_str())
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals("/", x.canonical_str())
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals("test.bloe/foo\, bar\, bar", x.canonical_str())
>>>>
>>>>        def test_canonical_ex_string(self):
>>>>            x = ldb.Dn(self.ldb, "dc=foo26,bar=bloe")
>>>>            self.assertEquals("/bloe\nfoo26", x.canonical_ex_str())
>>>> -
>>>> +        x = ldb.Dn(self.ldb, "")
>>>> +        self.assertEquals("\n", x.canonical_ex_str())
>>>> +        x = ldb.Dn(self.ldb, "cn=foo\, bar\, bar,dc=test,dc=bloe")
>>>> +        self.assertEquals("test.bloe\nfoo\, bar\, bar", x.canonical_ex_str())
>>>>
>>>>    class LdbMsgTests(unittest.TestCase):
>>>>
>>>>
>>>>
>>>>
>>>>          
>>>
>>>        
>>      
>    



More information about the samba-cvs mailing list