Exemple #1
0
 def test_9noteRecover(self):
     m=NetUtil()  
     values =  {
        
     }
     notePath=self.notecreate()
     values["Path"]=notePath 
     headers = {"Content-type": "application/json", "Accept": "text/plain",
             "AccountID":AccountID,"token":token}
           
     
     resp=m.http_post(domain_baseurl + "/Delete",values, headers)
     if resp["Code"]==0:
         m=NetUtil()  
         values =  {
         
         }
         values["Path"]=notePath
         headers = {"Content-type": "application/json", "Accept": "text/plain",
             "AccountID":AccountID,"token":token}
           
     
         resp=m.http_post(domain_baseurl + "/Recover",values, headers)
         if resp == None:  
             print m.errCode,m.errmsg  
         else:  
             print resp["Code"] 
         print "aaaaa:",resp["Code"]
         assert notePath==resp["Data"]["Path"]
Exemple #2
0
    def test_1Vote(self):
        n = note.TestUM()
        global notePath
        notePath = n.notecreate()
        invalidTime = int(round(time.time() * 1000))
        print invalidTime
        m = NetUtil()
        values = {
            "Path": notePath,
            "VoteType": 0,
            "InvalidTime": invalidTime,
            "VoteQuestion": "string",
            "VoteSelect": ["string", "test1"]
        }
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/VoteAdd", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        assert resp["Code"] == 0
Exemple #3
0
    def test_1Publish(self):
        n = note.TestUM()
        global notePath
        notePath = n.notecreate()
        m = NetUtil()
        values = {
            "Path": notePath,
            "Type": 4,
            "Data": {
                "Question": "string",
                "Answer": "string"
            }
        }
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/Publish", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        assert resp["Code"] == 0
Exemple #4
0
    def test_4categoryCreate(self):
        m = NetUtil()
        name = string.join(
            random.sample([
                'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o',
                'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c',
                'b', 'a'
            ], 5)).replace(' ', '')
        values = {"Name": name}

        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/Create", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        if resp["Code"] == 0:
            catePath = resp["Data"]["Path"]
            print catePath
        print "aaaaa:", resp["Code"]
        assert resp["Code"] == 0
Exemple #5
0
 def test_4noteCreate(self):
     c=category.TestUM()
     catePath=c.create()
     m=NetUtil()
     values = {
       "Author": "string",
       "Title": "string",
       "Summary": "string",
       "Content": "string",
       "CheckSum": "string",
       "IsPinned": 0
     }
     values["CategoryPath"]=catePath
     headers = {"Content-type": "application/json", "Accept": "text/plain",
                 "AccountID":AccountID,"token":token}
     resp=m.http_post(domain_baseurl + "/Create",values, headers)
     if resp == None:  
         print m.errCode,m.errmsg  
     else:  
         print resp 
     print "aaaaa:",resp["Data"]
     if resp["Code"]==0:
         global notePath
         notePath=resp["Data"]["Path"]
     assert resp["Code"]==0
Exemple #6
0
 def test_2AllTrash(self):
     m=NetUtil()  
     
     headers = {"Content-type": "application/json", "Accept": "text/plain",
                 "AccountID":AccountID,"token":token}
           
     
     resp=m.http_get(domain_baseurl + "/AllTrash",headers)
     if resp == None:  
         print m.errCode,m.errmsg  
     else:  
         print resp["Code"] 
     assert resp["Code"]==0
Exemple #7
0
    def test_2VoteGetByNote(self):
        m = NetUtil()
        print notePath
        values = {"Path": notePath}
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/VoteGetByNote", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        assert resp["Code"] == 0
        if resp["Code"] == 0:
            VoteID = resp["Data"]["VoteID"]
            selectID = resp["Data"]["VoteSelect"][0]["ID"]
            m = NetUtil()
            values = {"VoteID": VoteID}
            selects = []
            selects.append(selectID)
            print selects
            values["SelectID"] = selects
            print values
            headers = {
                "Content-type": "application/json",
                "Accept": "text/plain",
                "AccountID": AccountID,
                "token": token
            }
            resp = m.http_post(domain_baseurl + "/ClickVote", values, headers)
            print resp
            assert resp["Code"] == 0
Exemple #8
0
    def test_6GetQuestion(self):
        m = NetUtil()
        values = {"Path": notePath}
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/GetQuestion", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        assert resp["Code"] == 0
Exemple #9
0
 def test_3GetSyncCategorys(self):
     m=NetUtil()  
     Usn=random.randint(1,50)
     values={
         "Usn":Usn
     }
     headers = {"Content-type": "application/json", "Accept": "text/plain",
                 "AccountID":AccountID,"token":token}
           
     
     resp=m.http_post(domain_baseurl + "/GetSyncCategorys",values,headers)
     if resp == None:  
         print m.errCode,m.errmsg  
     else:  
         print resp["Code"] 
     assert resp["Code"]==0
Exemple #10
0
    def test_3categorySearch(self):
        m = NetUtil()
        values = {"Name": "test"}

        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/Search", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        print "aaaaa:", resp["Data"]
        assert resp["Code"] == 0
Exemple #11
0
    def test_6categoryNotelist(self):
        catePath = self.create()
        m = NetUtil()
        values = {"Path": catePath}
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/NoteList", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        print "aaaaa:", resp["Code"]
        assert resp["Code"] == 0
Exemple #12
0
    def test_5noteGet(self):
        m=NetUtil()  
        values =  {
            
        }
        values["Path"]=self.notecreate()

        headers = {"Content-type": "application/json", "Accept": "text/plain",
                "AccountID":AccountID,"token":token}
              
        
        resp=m.http_post(domain_baseurl + "/Get",values, headers)
        if resp == None:  
            print m.errCode,m.errmsg  
        else:  
            print resp["Code"] 
        print "aaaaa:",resp["Code"]
        assert resp["Code"]==0
Exemple #13
0
    def test_9categoryDeleteAll(self):

        catePath = self.create()
        print catePath
        m = NetUtil()
        values = {"Path": catePath}
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/DeleteAll", values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        print "aaaaa:", resp["Code"]
        assert catePath == resp["Data"]["Path"]
Exemple #14
0
 def test_10noteMove(self):
    
     c=category.TestUM()
     catePath=c.create()
     print catePath
     m=NetUtil()  
     values =  {
     }
     notePath=self.notecreate()
     values["Path"]=notePath
     values["CategoryPath"]=catePath
     headers = {"Content-type": "application/json", "Accept": "text/plain",
             "AccountID":AccountID,"token":token}
           
     
     resp=m.http_post(domain_baseurl + "/Move",values, headers)
     if resp == None:  
         print m.errCode,m.errmsg  
     else:  
         print resp["Code"] 
     print "aaaaa:",resp["Code"]
     assert notePath==resp["Data"]["Path"]
Exemple #15
0
    def test_6NoteUpdate(self):
        m = NetUtil()  
        values =  {
          "Author": "test",
          "Title": "string",
          "Summary": "test",
          "CheckSum": "string",
          "Content": "string",
          "IsPinned": 0,
          "UpdateTime": 0
        }
        values["Path"]=self.notecreate()

        headers = {"Content-type": "application/json", "Accept": "text/plain",
                "AccountID":AccountID,"token":token}
              
        
        resp=m.http_post(domain_baseurl + "/Update",values, headers)
        if resp == None:  
            print m.errCode,m.errmsg  
        else:  
            print resp 
        print "aaaaa:",resp["Code"]
        assert resp["Code"]==0
Exemple #16
0
    def test_1Qiniu(self):
        filekey = str(uuid.uuid4())

        n = note.TestUM()
        global notePath
        notePath = n.notecreate()
        fileName = string.join(
            random.sample([
                'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o',
                'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c',
                'b', 'a'
            ], 5)).replace(' ', '')
        m = NetUtil()
        values = {
            "FileKey": filekey,
            "FileType": "test",
            "FileName": fileName,
            "NotePath": notePath,
            "Expires": 3600
        }
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(domain_baseurl + "/GetUploadTokenWithCB", values,
                           headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]

        Token = resp["Data"]["UploadToken"]
        print Token
        localfile = './bbb.jpg'

        ret, info = put_file(Token, filekey, localfile)
        print(info)
        print ret
        assert ret['key'] == filekey
        assert ret['hash'] == etag(localfile)
        m = NetUtil()
        values = {"FileKey": filekey, "Expires": 3600}
        '''
        七牛回调地址为外网地址,获取回调接口调用外网地址
        '''
        headers = {
            "Content-type": "application/json",
            "Accept": "text/plain",
            "AccountID": AccountID,
            "token": token
        }

        resp = m.http_post(
            "http://devnotepad.zeusis.com:50047/API/V1.0/Cloud/GetDownloadURL",
            values, headers)
        if resp == None:
            print m.errCode, m.errmsg
        else:
            print resp["Code"]
        print resp
        assert resp["Code"] == 0