def get_test_node(context, **kw): """Return a Node object with appropriate attributes. NOTE: The object leaves the attributes marked as changed, such that a create() could be used to commit it to the DB. """ db_node = db_utils.get_test_node(**kw) # Let DB generate ID if it isn't specified explicitly if 'id' not in kw: del db_node['id'] node = objects.Node(context) for key in db_node: setattr(node, key, db_node[key]) return node
def node_post_data(**kw): node = utils.get_test_node(**kw) internal = node_controller.NodePatchType.internal_attrs() return remove_internal(node, internal)
def setUp(self): super(TestNodeObject, self).setUp() self.fake_node = utils.get_test_node()