def test_makeText():
    pub = Publishing()
    pub.user_id = "Superform"
    pub.post_id = "1"
    pub.date_from = '13.02.02'
    pub.title = 'test-Title'
    pub.link_url = 'blablablablablablablajdsfvjdbvjdnfvqebdnbqdfnvsdùnvbmqknkfnbùsfvdf'
    pub.description = 'descr'
    pub.image_url = 'image url'
    pub.date_until = '14.02.16'
    pub.state = 1
    pub.channel_id = 8

    text = wiki.makeText(pub, pub.user_id)
    tab_of_text = text.splitlines()
    date = str(datetime.datetime.now().strftime("%d/%m/%Y"))

    assert tab_of_text[0] == "!! " + pub.title
    assert tab_of_text[1] == "Par " + "Superform" + " Publié le " + date
    assert tab_of_text[2] == ""
    assert tab_of_text[
        3] == "-----"  #+str(pub.description).replace("\n","[[<<]]")
    assert tab_of_text[4] == str(pub.description).replace("\n", "[[<<]]")
    assert tab_of_text[5] == ""
    assert tab_of_text[6] == "-----" + "[[" + pub.link_url + "]]"
    assert tab_of_text[7] == "-----"
    assert tab_of_text[8] == pub.image_url
Exemple #2
0
def publish_from_post(post, channel_id):
    pub = Publishing()
    pub.post_id = post.id
    pub.user_id = post.user_id
    pub.title = post.title
    pub.description = post.description
    pub.date_from = post.date_from
    pub.date_until = post.date_until
    pub.state = 0
    pub.channel_id = channel_id
    return pub