diff --git a/oslo_versionedobjects/fixture.py b/oslo_versionedobjects/fixture.py index 9c1925a..407b908 100644 --- a/oslo_versionedobjects/fixture.py +++ b/oslo_versionedobjects/fixture.py @@ -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()) diff --git a/oslo_versionedobjects/tests/test_fixture.py b/oslo_versionedobjects/tests/test_fixture.py index 46effce..bd564da 100644 --- a/oslo_versionedobjects/tests/test_fixture.py +++ b/oslo_versionedobjects/tests/test_fixture.py @@ -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