示例#1
0
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
示例#2
0
文件: utils.py 项目: mkscala/magnum
def node_post_data(**kw):
    node = utils.get_test_node(**kw)
    internal = node_controller.NodePatchType.internal_attrs()
    return remove_internal(node, internal)
示例#3
0
 def setUp(self):
     super(TestNodeObject, self).setUp()
     self.fake_node = utils.get_test_node()
示例#4
0
 def setUp(self):
     super(TestNodeObject, self).setUp()
     self.fake_node = utils.get_test_node()