1 # Copyright 2015 IBM Corp.
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
18 from oslo_versionedobjects import base as obj_base
19 from oslo_versionedobjects import fixture
21 from neutron.tests import base as test_base
24 # NOTE: The hashes in this list should only be changed if they come with a
25 # corresponding version bump in the affected objects.
27 'QosBandwidthLimitRule': '1.0-4e44a8f5c2895ab1278399f87b40a13d',
28 'QosRuleType': '1.0-d0df298d49eeffab91af18d1a4cf7eaf',
29 'QosPolicy': '1.0-721fa60ea8f0e8f15d456d6e917dfe59',
33 class TestObjectVersions(test_base.BaseTestCase):
35 def test_versions(self):
36 checker = fixture.ObjectVersionChecker(
37 obj_base.VersionedObjectRegistry.obj_classes())
38 fingerprints = checker.get_hashes()
40 if os.getenv('GENERATE_HASHES'):
41 file('object_hashes.txt', 'w').write(
42 pprint.pformat(fingerprints))
44 expected, actual = checker.test_hashes(object_data)
45 self.assertEqual(expected, actual,
46 'Some objects have changed; please make sure the '
47 'versions have been bumped, and then update their '
48 'hashes in the object_data map in this test module.')