Add a NodePayload test
This adds a test case for NodePayload to ensure that: 1. All the items in its SCHEMA have corresponding fields within the payload 2. All the items in its SCHEMA have matching fields in the Node class This should help mitigate the potential for either the Node object or NodePayload to change in a way that breaks node notifications. Change-Id: I85eb45cbd2b01b539b16b89b4e580cbbda51cbda
This commit is contained in:
parent
2a4d3cc5e8
commit
43fefe9023
@ -195,3 +195,17 @@ class TestNodeObject(base.DbTestCase):
|
||||
}
|
||||
node._validate_property_values(values['properties'])
|
||||
self.assertEqual(expect, values['properties'])
|
||||
|
||||
def test_node_payload_schema(self):
|
||||
"""Assert that NodePayload.SCHEMA has expected properties.
|
||||
|
||||
NodePayload.SCHEMA should:
|
||||
|
||||
1. Have each of its keys in NodePayload.fields
|
||||
2. Have each member of the schema match with a corresponding field
|
||||
on the Node object
|
||||
"""
|
||||
for schema_key in objects.node.NodePayload.SCHEMA:
|
||||
self.assertIn(schema_key, objects.node.NodePayload.fields)
|
||||
node_key = objects.node.NodePayload.SCHEMA[schema_key][1]
|
||||
self.assertIn(node_key, objects.node.Node.fields)
|
||||
|
Loading…
x
Reference in New Issue
Block a user