self.__diff = isc.xfrin.diff.Diff(datasrc_client, zname,
journaling=True,
single_update_mode=True)
- _, self.__finder = datasrc_client.find_zone(zname)
+ # Note that while it is really the ZoneUpdater that is set
+ # here, it is still called finder, as the only methods that
+ # are and should be used on this object are find() and find_all()
+ # (ZoneUpdater provides the ZoneFinder interface itself, no
+ # separate get_zone_finder())
+ self.__finder = self.__diff.get_updater()
self.__zname = zname
self.__zclass = zclass
self.__datasrc_client = datasrc_client
rrset.get_type(),
ZoneFinder.NO_WILDCARD |
ZoneFinder.FIND_GLUE_OK)
- if result == self.__finder.CNAME:
+ if result == ZoneFinder.CNAME:
# Ignore non-cname rrs that try to update CNAME records
# (if rrset itself is a CNAME, the finder result would be
# SUCCESS, see next case)
self._acl_map))
self._session._UpdateSession__get_update_zone()
+ def tearDown(self):
+ # With the Updater created in __get_update_zone, and tests
+ # doing all kinds of crazy stuff, one might get database locked
+ # errors if it doesn't clean up explicitely after each test
+ self._session = None
+
def check_response(self, msg, expected_rcode):
'''Perform common checks on update resposne message.'''
self.assertTrue(msg.get_header_flag(Message.HEADERFLAG_QR))
self.assertEqual(expected, strings)
- def __prereq_helper(self, method, expected, rrset):
- '''Calls the given method with self._datasrc_client
- and the given rrset, and compares the return value.
- Function does not do much but makes the code look nicer'''
- self.assertEqual(expected, method(rrset))
-
def __check_prerequisite_exists_combined(self, method, rrclass, expected):
'''shared code for the checks for the very similar (but reversed
in behaviour) methods __prereq_rrset_exists and
raise ValueError("Separate buffers requested in single-update mode")
else:
return (self.__deletions, self.__additions)
+
+ def get_updater(self):
+ """
+ Returns the ZoneUpdater associated with this Diff instance.
+ While update statements can be used on this updater, its main
+ goal is to provide the ZoneFinder interface for searching through
+ the zone as it was on the moment the updater was created.
+ If the Diff has been committed, this will return None.
+ """
+ return self.__updater