Merge "Extend test_hashes to allow extra info gathering"

This commit is contained in:
Jenkins 2016-07-05 19:45:59 +00:00 committed by Gerrit Code Review
commit 8e9c8c8759
2 changed files with 12 additions and 2 deletions

View File

@ -265,8 +265,8 @@ class ObjectVersionChecker(object):
obj_name, extra_data_func=extra_data_func)
return fingerprints
def test_hashes(self, expected_hashes):
fingerprints = self.get_hashes()
def test_hashes(self, expected_hashes, extra_data_func=None):
fingerprints = self.get_hashes(extra_data_func=extra_data_func)
stored = set(expected_hashes.items())
computed = set(fingerprints.items())

View File

@ -322,6 +322,16 @@ class TestObjectVersionChecker(test.TestCase):
"should contain the updated object with the new "
"hash.")
def test_test_hashes_passes_extra_func(self):
# Make sure that test_hashes passes the extra_func to get_hashes
mock_extra_func = mock.Mock()
with mock.patch.object(self.ovc, 'get_hashes') as mock_get_hashes:
self.ovc.test_hashes({}, extra_data_func=mock_extra_func)
mock_get_hashes.assert_called_once_with(
extra_data_func=mock_extra_func)
def test_get_dependency_tree(self):
# Make sure get_dependency_tree() gets the dependencies of all
# objects in the registry