Beispiel #1
0
 def test_1(self):
     """ test save node """
     node = common.File()
     node.name = "tmp"
     node.content = {"user":"******"}
     r = sdk.cmd_savenode(data=node.serialize(), db="test")
     self.assertTrue(r)
Beispiel #2
0
    def test_8(self):
        """ test save attachment """
        attchmnt_f = os.path.join(os.path.abspath(os.path.dirname(__file__)),"pic1.jpg")
        r = sdk.cmd_saveattachment(path=attchmnt_f,db="test")
        self.assertTrue(r)
        path = r

        # get node
        r = sdk.cmd_getnode_bypath(path="/tmp",db="test",fields=[])
        node = r
        node["__header__"]["filepointer"] = path

        r = sdk.cmd_savenode(data=node, db="test")
        self.assertTrue(r)
Beispiel #3
0
    def test_4(self):
        """ test parent/child relationship """
        node = common.File()
        node.name = "tmp2"
        node.content = {"user":"******"}
        r = sdk.cmd_savenode(data=node.serialize(), db="test")
        self.assertTrue(r)
        child_id = r

        # get parent node
        query = {"__header__.name":"/"}
        r = sdk.cmd_getnode(query=query,db="test",fields=["_id"])
        parent_id = r["_id"]

        # create link
        req = json.dumps({"parent_docId":parent_id,
                          "child_docId":child_id,
                          "db":"test"})
        r = sdk.cmd_addchild(parent_docId=parent_id, child_docId=child_id,db="test")
        self.assertTrue(r)