Пример #1
0
Файл: post.py Проект: ptmono/ppf
def writeArticle(doc_id, _base64_content):
    """

    >>> doc_id = '0706012057'
    >>> _base64_content = '열라 테스트'
    >>> #ma = MuseArticle('1201170413')    
    >>> #ma.html
    >>> #dd = writeArticle('1201170413', ma.html)
    >>> #dd
    >>> #dd = writeArticle(doc_id, _base64_content)
    >>> #dd.read()
    >>> #'\\nOK\\n'

    """
    data = Data()
    data.cmd = "writeArticle"
    data.doc_id = doc_id
    data._base64_content = _base64_content

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()

    return result
Пример #2
0
Файл: post.py Проект: ptmono/ppf
def deleteComment(doc_id, comment_id):
    """
    deleteComment("0706012057", "26")
    """
    #libs.log(doc_id)
    #libs.log(comment_id)
    data = Data()
    data.cmd = "deleteComment"
    data.doc_id = doc_id
    data.comment_id = comment_id

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Пример #3
0
Файл: post.py Проект: ptmono/ppf
def updateIndex(doc_id, _jsonBase64_dict):
    """

    >>> doc_id = '0706012057'
    >>> _jsonBase64_dict = {'category': 'emacs planner', 'date': '1108170951', 'author': 'this is author', 'update': '1108170952', 'title': '가나다 우리는 사는 사람들 이 닫 다다. fjdksf kdsf ', 'doc_id': '0706012057'}
    >>> #dd = updateIndex(doc_id, _jsonBase64_dict)
    >>> #dd.read()
    >>> #'\\nOK\\n'
    """

    data = Data()
    data.cmd = "updateIndex"
    data.doc_id = doc_id
    data._jsonBase64_dict = _jsonBase64_dict

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Пример #4
0
Файл: post.py Проект: ptmono/ppf
def writeComment(doc_id, _base64_content, _base64_name='', password=''):
    """
    >>> doc_id = '0706012057'
    >>> _base64_content = '어찌하다가 우리가 이런일에\\n 아'
    >>> _base64_name = '달수'
    >>> password = '******'
    >>> #dd = writeComment(doc_id, _base64_content, _base64_name, password)
    >>> #dd.read()
    >>> #'\\nOK\\n' # This is output
    """
    data = Data()
    data.cmd = "writeComment"
    data.doc_id = doc_id
    data._base64_content = _base64_content
    data._base64_name = _base64_name
    data.password = password

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Пример #5
0
    def test_basic(self):
        b = get_browser()
        query = Data()
        query.cmd = 'articles_length'

        url = config.url_root + 'api.py?' + query.urlencode()
        b.go(url)
        result = b.get_html()
        # For Secure key. server is using secure key?
        self.assertNotEqual(result.find('Error'), -1)

        # For articles_length
        query.secure_key = config.SECURE_KEY
        url = config.url_root + 'api.py?' + query.urlencode()

        b.go(url)
        result = b.get_html()
        self.assertEqual(libs.removeBlank(result), '2')

        # For comments_length
        query.cmd = 'comments_length'
        query.doc_id = Var.dummy_id

        url = config.url_root + 'api.py?' + query.urlencode()
        b.go(url)
        result = b.get_html()
        self.assertEqual(libs.removeBlank(result), '1')

        # For article_json
        query.cmd = 'article_json'
        url = config.url_root + 'api.py?' + query.urlencode()
        b.go(url)
        result = b.get_html()
        # Get the index of the local dummy
        article = Article()
        article.set(Var.dummy_id)
        result = json.loads(libs.removeBlank(result))
        self.assertEqual(result['doc_id'], unicode(article.__dict__['doc_id']))