def test_VersionedNode_init_without_args(self):
     self.printLine()
     node = VersionedNode()
     node.save()
     print node.uuid, node.timestamp
     node2 = VersionedNode.pull(node.uuid)
     assert node2.uuid == node.uuid
     self.printLine()
 def test_VersionedNode_update_field_dict_append(self):
     self.printLine()
     setattr(VersionedNode, "foo", CaliopeJSONProperty())
     node = VersionedNode()
     node.save()
     print node.uuid, node.timestamp, node.foo
     node.update_field("foo", "bar", field_id="foo")
     assert node.foo["foo"] == "bar"
     self.printLine()
 def test_versionednode_update_field(self):
     self.printLine()
     node = VersionedNode()
     node.foo = 'bar'
     node.save()
     print node.uuid, node.timestamp, node.foo
     node.update_field("foo", "new_bar")
     assert node.foo == "new_bar"
     self.printLine()
 def test_VersionedNode_init_with_args(self):
     self.printLine()
     props = {'foo': 'bar', 'other': 2}
     node = VersionedNode(**props)
     node.save()
     print node.uuid, node.timestamp
     node.refresh()
     assert node.foo == 'bar' and node.other == 2
     self.printLine()
 def test_VersionedNode_update_field_dict_update(self):
     self.printLine()
     setattr(VersionedNode, "foo", CaliopeJSONProperty())
     node = VersionedNode()
     node.foo = {"foo": "bar", "a": 1}
     node.save()
     print node.uuid, node.timestamp, node.foo
     node.update_field("foo", "new_bar", "foo")
     assert node.foo["foo"] == "new_bar"
     self.printLine()
 def test_VersionedNode_update_field_list_append(self):
     self.printLine()
     node = VersionedNode()
     node.foo = ['item0', "item1"]
     node.save()
     print node.uuid, node.timestamp, node.foo
     node.update_field("foo", "bar", 0)
     assert node.foo[0] == "bar"
     assert node.foo[1] == "item1"
     self.printLine()