BIND 10 trac2439, updated. 79a33db9ed37ba4715b35d1d9c74dcc550a50788 [2439] Inherit the mock from RRsetCollectionBase

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 24 17:41:49 UTC 2013


The branch, trac2439 has been updated
       via  79a33db9ed37ba4715b35d1d9c74dcc550a50788 (commit)
       via  44fe82eeedff8f69053c6f455134a256daab3340 (commit)
      from  97953d08e3259263743138dcc81ef4332e585e39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 79a33db9ed37ba4715b35d1d9c74dcc550a50788
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Jan 24 18:40:10 2013 +0100

    [2439] Inherit the mock from RRsetCollectionBase
    
    And make the test slightly cleaner by that. No change in functionality,
    just rely on assumptions about what breaking of API don't matter little
    bit less.

commit 44fe82eeedff8f69053c6f455134a256daab3340
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Jan 24 18:39:46 2013 +0100

    [2439] (minor) Comment updates

-----------------------------------------------------------------------

Summary of changes:
 src/lib/python/isc/xfrin/diff.py             |    4 +--
 src/lib/python/isc/xfrin/tests/diff_tests.py |   35 ++++++++++++++++++--------
 2 files changed, 27 insertions(+), 12 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/xfrin/diff.py b/src/lib/python/isc/xfrin/diff.py
index 2d063ae..8d0bb08 100644
--- a/src/lib/python/isc/xfrin/diff.py
+++ b/src/lib/python/isc/xfrin/diff.py
@@ -589,8 +589,8 @@ class Diff:
         '''
         This first applies all changes to the data source. Then it creates
         and returns an RRsetCollection on top of the corresponding zone
-        updater and returns it. Notice it might be impossible to apply more
-        changes after that.
+        updater. Notice it might be impossible to apply more changes after
+        that.
 
         This must not be called after a commit, or it'd throw ValueError.
         '''
diff --git a/src/lib/python/isc/xfrin/tests/diff_tests.py b/src/lib/python/isc/xfrin/tests/diff_tests.py
index 72dc8bb..0a33f67 100644
--- a/src/lib/python/isc/xfrin/tests/diff_tests.py
+++ b/src/lib/python/isc/xfrin/tests/diff_tests.py
@@ -16,7 +16,8 @@
 import isc.log
 import unittest
 from isc.datasrc import ZoneFinder
-from isc.dns import Name, RRset, RRClass, RRType, RRTTL, Rdata, RRsetCollection
+from isc.dns import Name, RRset, RRClass, RRType, RRTTL, Rdata, \
+    RRsetCollectionBase
 from isc.xfrin.diff import Diff, NoSuchZone
 
 class TestError(Exception):
@@ -1087,14 +1088,26 @@ class DiffTest(unittest.TestCase):
             self.__check_find_all_call(diff.find_all, self.__rrset3,
                                        rcode)
 
-    class Collection:
+    class Collection(isc.dns.RRsetCollectionBase):
         '''
-        Our own mock RRsetCollection. We don't use it, just pass it through.
-        This is to implement the below method.
+        Our own mock RRsetCollection. We only pass it through, but we
+        still define an (mostly empty) find method to satisfy the
+        expectations.
         '''
-        # Any idea why python doesn't agree with inheriting from
-        # dns.RRsetCollection?
-        pass
+        def __init__(self):
+            '''
+            Empty init. The base class's __init__ can't be called,
+            so we need to provide our own to shadow it -- and make sure
+            not to call the parent().__init__().
+            '''
+            pass
+
+        def find(self, name, rrclass, rrtype):
+            '''
+            Empty find method. Returns None to each query (pretends
+            the collection is empty. Present mostly for completeness.
+            '''
+            return None
 
     def get_rrset_collection(self):
         '''
@@ -1111,13 +1124,15 @@ class DiffTest(unittest.TestCase):
         diff = Diff(self, Name('example.org'), single_update_mode=True)
         diff.add_data(self.__rrset_soa)
         collection = diff.get_rrset_collection()
-        # Check it is commited
+        # Check it is applied
         self.assertEqual(1, len(self.__data_operations))
         self.assertEqual('add', self.__data_operations[0][0])
         # Check the returned one is actually RRsetCollection
         self.assertTrue(collection, self.Collection)
-        # We don't call anything on the collection. It's just the mock from
-        # above, so it wouldn't be any good.
+        # The collection is just the mock from above, so this doesn't do much
+        # testing, but we check that the mock got through and didn't get hurt.
+        self.assertIsNone(collection.find(Name('example.org'), RRClass.IN(),
+                                          RRType.SOA()))
 
 if __name__ == "__main__":
     isc.log.init("bind10")



More information about the bind10-changes mailing list