Ejemplo n.º 1
0
def copy_new_post(post_id):
    """
    This method copy the content of a post (defined by his post_id) and open the new post tab with all the informations
    of the original post copied in it (and with the title modified)
    :param post_id: id of the original post to be copied
    :return:
    """
    user_id = session.get("user_id", "") if session.get("logged_in",
                                                        False) else -1
    list_of_channels = channels_available_for_user(user_id)

    ictv_chans = []

    for elem in list_of_channels:
        m = elem.module
        clas = get_instance_from_module_path(m)
        unavailable_fields = '.'.join(clas.FIELDS_UNAVAILABLE)
        setattr(elem, "unavailablefields", unavailable_fields)

        if 'ictv_data_form' in unavailable_fields:
            ictv_chans.append(elem)

    # Query the data from the original post
    original_post = db.session.query(Post).filter(Post.id == post_id).first()
    post = Post(user_id=user_id,
                title="Copy of " + original_post.title,
                description=original_post.description,
                link_url=original_post.link_url,
                image_url=original_post.image_url,
                date_from=original_post.date_from,
                date_until=original_post.date_until)
    if request.method == "GET":
        ictv_data = None
        if len(ictv_chans) != 0:
            from plugins.ictv import process_ictv_channels
            ictv_data = process_ictv_channels(ictv_chans)

        post.date_from = str_converter(post.date_from)
        post.date_until = str_converter(post.date_until)
        return render_template('new.html',
                               l_chan=list_of_channels,
                               ictv_data=ictv_data,
                               post=post,
                               new=True)
    else:
        create_a_post(request.form)
        flash("The post was successfully copied.", category='success')
        return redirect(url_for('index'))
def test_postpre_gcal():
    ret_code = gcal.post_pre_validation(
        Post(title="gcal test",
             description="desc gcal test",
             link_url="www.test.com",
             image_url="www.test.com"))
    assert ret_code == 1
Ejemplo n.º 3
0
def test_delete_not_author(client):
    user_id = "myself"
    user_id_author = "1"
    login(client, user_id)

    title_post = "title_test"
    descr_post = "description"
    link_post = "link"
    image_post = "img"
    date_from = datetime_converter("2018-01-01")
    date_until = datetime_converter("2018-01-10")
    p = Post(user_id=user_id_author, title=title_post, description=descr_post, link_url=link_post, image_url=image_post,
             date_from=date_from, date_until=date_until)
    db.session.add(p)
    db.session.commit()

    id_post = p.id

    path = '/delete/' + str(id_post)

    client.get(path)

    deleted_post = db.session.query(Post).filter_by(id=id_post).first()

    assert deleted_post is None

    db.session.delete(p)
    db.session.commit()
Ejemplo n.º 4
0
def create_a_post(form):  # called in publish_from_new_post() & new_post()
    user_id = session.get("user_id", "") if session.get("logged_in", False) else -1
    title_post = form.get('titlepost')
    descr_post = form.get('descriptionpost')
    link_post = form.get('linkurlpost')
    image_post = form.get('imagepost')

    # set default date if none was chosen
    if form.get('datefrompost') is '':
        date_from = date.today()
    else:
        date_from = datetime_converter(form.get('datefrompost'))
    if form.get('dateuntilpost') is '':
        date_until = date.today() + timedelta(days=7)
    else:
        date_until = datetime_converter(form.get('dateuntilpost'))

    # set hour to a default value since form doesn't provide one
    start_hour = time_converter("00:00")
    end_hour = time_converter("23:59")

    p = Post(user_id=user_id, title=title_post, description=descr_post, link_url=link_post, image_url=image_post,
             date_from=date_from, date_until=date_until, start_hour=start_hour, end_hour=end_hour)
    db.session.add(p)
    db.session.commit()
    return p
Ejemplo n.º 5
0
def test_postpre_rss():
    ret_code = rss.post_pre_validation(
        Post(title="rss test",
             description="desc rss test",
             link_url="www.test.com",
             image_url="www.test.com"))
    assert ret_code == 1
Ejemplo n.º 6
0
def test_delete_post(client):
    user_id = "myself"
    login(client, user_id)

    title_post = "title_test"
    descr_post = "description"
    link_post = "link"
    image_post = "img"
    date_from = datetime_converter("2018-01-01")
    date_until = datetime_converter("2018-01-10")
    p = Post(user_id=user_id,
             title=title_post,
             description=descr_post,
             link_url=link_post,
             image_url=image_post,
             date_from=date_from,
             date_until=date_until)
    db.session.add(p)
    db.session.commit()

    id_post = p.id

    path = '/delete_post/' + str(id_post)

    # verify that something has been posted/published
    assert db.session.query(Post).filter_by(id=id_post).first() is not None

    client.get(path)

    deleted_post = db.session.query(Post).filter_by(id=id_post).first()
    assert deleted_post is None
def create_a_post(form):
    user_id = session.get("user_id", "") if session.get("logged_in", False) else -1
    title_post = form.get('titlepost')
    descr_post = form.get('descriptionpost')
    link_post = form.get('linkurlpost')
    image_post = form.get('imagepost')
    date_from = datetime_converter(form.get('datefrompost'))
    date_until = datetime_converter(form.get('dateuntilpost'))
    p = Post(user_id=user_id, title=title_post, description=descr_post, link_url=link_post, image_url=image_post,
             date_from=date_from, date_until=date_until)
    db.session.add(p)
    db.session.commit()
    return p
def validate_rework_publishing(id, idc):
    """
    Validate the modifications applied to the publishing
    :param id: post id
    :param idc: channel id
    :return: an error message if the publishing has already been reworked else redirect to the index
    """
    pub = db.session.query(Publishing).filter(
        Publishing.post_id == id, Publishing.channel_id == idc).first()
    post = db.session.query(Post).filter(Post.id == id).first()
    # Only pubs that have yet to be moderated can be accepted
    if pub.state == State.VALIDATED.value:
        flash("This publication has already been reworked.", category='error')
        return redirect(url_for('index'))

    new_post = Post(user_id=post.user_id,
                    title=pub.title,
                    description=pub.description,
                    date_created=post.date_created,
                    link_url=pub.link_url,
                    image_url=pub.image_url,
                    date_from=pub.date_from,
                    date_until=pub.date_until)
    db.session.add(new_post)
    db.session.commit()

    new_pub = Publishing(post_id=new_post.id,
                         channel_id=pub.channel_id,
                         state=pub.state,
                         title=pub.title,
                         date_until=pub.date_until,
                         date_from=pub.date_from,
                         rss_feed=pub.rss_feed)

    pub.state = State.OUTDATED.value
    db.session.add(new_pub)
    db.session.commit()

    update_pub(new_pub, State.NOTVALIDATED.value)
    db.session.commit()

    create_a_moderation(request.form,
                        new_post.id,
                        new_pub.channel_id,
                        parent_post_id=id)
    flash("The rework has been submitted.", category='success')
    return redirect(url_for('index'))
Ejemplo n.º 9
0
def test_delete_publishing(client):
    user_id = "myself"
    login(client, user_id)

    title_post = "title_test"
    descr_post = "description"
    link_post = "link"
    image_post = "img"
    date_from = datetime_converter("2018-01-01")
    date_until = datetime_converter("2018-01-10")
    p = Post(user_id=user_id, title=title_post, description=descr_post, link_url=link_post, image_url=image_post,
             date_from=date_from, date_until=date_until)
    db.session.add(p)
    db.session.commit()

    id_post = p.id
    id_channel = 1

    # Try with a publishing submitted for review (state=0)
    pub1 = Publishing(post_id=id_post, channel_id=id_channel, state=0, title=title_post, description=descr_post,
                     link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until)
    db.session.add(pub1)
    db.session.commit()

    path = '/delete_publishing/' + str(id_post) + '/' + str(id_channel)

    client.get(path)

    deleted_publishing = db.session.query(Publishing).filter(Publishing.post_id == id_post).first()
    assert deleted_publishing is None

    # Try with a publishing already posted (state=1)
    pub2 = Publishing(post_id=id_post, channel_id=id_channel, state=1, title=title_post, description=descr_post,
                      link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until)
    db.session.add(pub2)
    db.session.commit()

    path = '/delete_publishing/' + str(id_post) + '/' + str(id_channel)

    client.get(path)

    deleted_publishing = db.session.query(Publishing).filter(Publishing.post_id == id_post).first()
    assert deleted_publishing is None

    db.session.delete(p)
    db.session.commit()
Ejemplo n.º 10
0
def setup_db(channelName, pluginName):
    global user_admin
    myself_user = db.session.query(User).get('myself')
    if not myself_user:
        myself_user = create_user(id="myself",
                                  name="myself",
                                  first_name="myself",
                                  email="myself")
    user_admin = myself_user.admin
    myself_user.admin = 1

    id_channel = 0

    channel = Channel(id=id_channel,
                      name=channelName,
                      module=pluginName,
                      config="{}")
    db.session.add(channel)
    authorization = Authorization(user_id="myself",
                                  channel_id=id_channel,
                                  permission=2)
    db.session.add(authorization)

    id_post = 0

    post = Post(
        id=id_post,
        user_id="myself",
        title="first title",
        description=
        "That know ask case sex ham dear her spot. Weddings followed the all marianne nor whatever settling. Perhaps six prudent several her had offence. Did had way law dinner square tastes. Recommend concealed yet her procuring see consulted depending. Adieus hunted end plenty are his she afraid. Resources agreement contained propriety applauded neglected use yet. ",
        link_url="http://facebook.com/",
        image_url="pas",
        date_from=datetime_converter("2018-07-01"),
        date_until=datetime_converter("2018-07-01"))
    db.session.add(post)

    try:
        db.session.commit()
    except Exception as e:
        print(str(e))
        db.session.rollback()
    return id_channel, id_post
Ejemplo n.º 11
0
def create_a_post(form):  # called in publish_from_new_post() & new_post()
    user_id = session.get("user_id", "") if session.get("logged_in", False) else -1
    title_post = form.get('titlepost')
    descr_post = form.get('descriptionpost')
    link_post = form.get('linkurlpost')
    image_post = form.get('imagepost')
    if form.get('datefrompost') is '':
        # set default date if no date was chosen
        date_from = date.today()
    else:
        date_from = datetime_converter(form.get('datefrompost'))
    if form.get('dateuntilpost') is '':
        date_until = date.today() + timedelta(days=7)
    else:
        date_until = datetime_converter(form.get('dateuntilpost'))
    p = Post(user_id=user_id, title=title_post, description=descr_post, link_url=link_post, image_url=image_post,
             date_from=date_from, date_until=date_until)
    db.session.add(p)
    db.session.commit()
    return p
def setup_db():
    global user_admin
    myself_user = db.session.query(User).get('myself')
    user_admin = myself_user.admin
    myself_user.admin = 1

    id_channels = [0, -1, -2]
    id_posts = [0, -1, -2]
    channel = Channel(id=id_channels[0], name="Test_channel_1", module="superform.plugins.Twitter", config="{}")
    db.session.add(channel)
    channel = Channel(id=id_channels[1], name="Test_channel_2", module="superform.plugins.Twitter", config="{}")
    db.session.add(channel)
    channel = Channel(id=id_channels[2], name="Test_channel_3", module="superform.plugins.Twitter", config="{}")
    db.session.add(channel)

    authorization = Authorization(user_id="myself", channel_id=id_channels[0], permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="myself", channel_id=id_channels[1], permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="myself", channel_id=id_channels[2], permission=2)
    db.session.add(authorization)

    post = Post(id=id_posts[0], user_id="myself", title="first title #123456789123456789123456789title",
                description="This is a test, yes it really is. #123456789123456789123456789descr",
                link_url="http://facebook.com/", image_url="pas", date_from=datetime_converter("2018-08-08"),
                date_until=datetime_converter("2018-08-10"))
    db.session.add(post)
    post = Post(id=id_posts[1], user_id="myself", title="first title #123456789123456789123456789title ",
                description="This is a test, yes it really is. #123456789123456789123456789descr",
                link_url="http://facebook.com/", image_url="pas", date_from=datetime_converter("2018-10-08"),
                date_until=datetime_converter("2018-11-10"))
    db.session.add(post)
    post = Post(id=id_posts[2], user_id="myself", title="first title #98765410987654321876543223456title notvisible",
                description="This is a test, yes it really is. #98765410987654321876543223456title notvisible",
                link_url="http://facebook.com/", image_url="pas", date_from=datetime_converter("2018-10-08"),
                date_until=datetime_converter("2018-11-10"))
    db.session.add(post)

    publishing = Publishing(post_id=id_posts[0], channel_id=id_channels[0], state=1,
                            title="first title #123456789123456789123456789title published",
                            description="This is a test, yes it really is. #123456789123456789123456789descr published",
                            link_url="http://facebook.com/", image_url="pas",
                            date_from=datetime_converter("2018-08-08"),
                            date_until=datetime_converter("2018-08-10"), extra="{}")
    db.session.add(publishing)
    publishing = Publishing(post_id=id_posts[0], channel_id=id_channels[1], state=0,
                            title="first title #123456789123456789123456789title waitingforapproval",
                            description="This is a test, yes it really is. #123456789123456789123456789descr waitingforapproval",
                            link_url="http://facebook.com/", image_url="pas",
                            date_from=datetime_converter("2018-11-11"),
                            date_until=datetime_converter("2018-11-12"), extra="{}")
    db.session.add(publishing)
    publishing = Publishing(post_id=id_posts[0], channel_id=id_channels[2], state=2,
                            title="first title #123456789123456789123456789title archived",
                            description="This is a test, yes it really is. #123456789123456789123456789descr archived",
                            link_url="http://facebook.com/", image_url="pas",
                            date_from=datetime_converter("2018-12-11"),
                            date_until=datetime_converter("2018-12-12"), extra="{}")
    db.session.add(publishing)

    try:
        db.session.commit()
    except Exception as e:
        print(str(e))
        db.session.rollback()
    return id_channels, id_posts
Ejemplo n.º 13
0
def populate_db():
    User.query.delete()
    user = User(id="michouchou",
                email="*****@*****.**",
                name="t",
                first_name="est",
                admin=False)
    db.session.add(user)
    user = User(id="googleplusmoderator",
                email="*****@*****.**",
                name="Press F",
                first_name="To pay respect",
                admin=False)
    db.session.add(user)
    user = User(id="mr_inutile69",
                email="*****@*****.**",
                name="MR",
                first_name="PS",
                admin=False)
    db.session.add(user)
    user = User(id="channelwriter",
                email="*****@*****.**",
                name="Channel",
                first_name="von LECRIVAIN",
                admin=False)
    db.session.add(user)
    user = User(id="channelmoder",
                email="*****@*****.**",
                name="Channel",
                first_name="van Moderate",
                admin=False)
    db.session.add(user)
    user = User(id="admin",
                email="*****@*****.**",
                name="Admin",
                first_name="van Ze Broek",
                admin=True)
    db.session.add(user)

    Channel.query.delete()
    channel = Channel(id=1,
                      name="Twitter",
                      module="superform.plugins.Twitter",
                      config="{}")
    db.session.add(channel)
    channel = Channel(id=2,
                      name="GPlus",
                      module="superform.plugins.Gplus",
                      config="{}")
    db.session.add(channel)
    channel = Channel(id=3,
                      name="RSS",
                      module="superform.plugins.RSS",
                      config="{}")
    db.session.add(channel)
    channel = Channel(id=4,
                      name="GMoins",
                      module="superform.plugins.Gmoins",
                      config="{}")
    db.session.add(channel)

    Authorization.query.delete()
    authorization = Authorization(user_id="michouchou",
                                  channel_id=1,
                                  permission=1)
    db.session.add(authorization)
    authorization = Authorization(user_id="admin", channel_id=1, permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="admin", channel_id=2, permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="admin", channel_id=3, permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="admin", channel_id=4, permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="googleplusmoderator",
                                  channel_id=2,
                                  permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="channelwriter",
                                  channel_id=4,
                                  permission=1)
    db.session.add(authorization)
    authorization = Authorization(user_id="channelmoder",
                                  channel_id=1,
                                  permission=2)
    db.session.add(authorization)
    authorization = Authorization(user_id="channelmoder",
                                  channel_id=3,
                                  permission=1)
    db.session.add(authorization)

    Post.query.delete()
    post = Post(
        id=1,
        user_id="channelmoder",
        title="first title",
        description=
        "That know ask case sex ham dear her spot. Weddings followed the all marianne nor whatever settling. Perhaps six prudent several her had offence. Did had way law dinner square tastes. Recommend concealed yet her procuring see consulted depending. Adieus hunted end plenty are his she afraid. Resources agreement contained propriety applauded neglected use yet. ",
        link_url="http://facebook.com/",
        image_url="pas",
        date_from=datetime_converter("2018-07-01"),
        date_until=datetime_converter("2018-07-01"))
    db.session.add(post)
    post = Post(
        id=2,
        user_id="michouchou",
        title="second title",
        description=
        "first title Him rendered may attended concerns jennings reserved now. Sympathize did now preference unpleasing mrs few. Mrs for hour game room want are fond dare. For detract charmed add talking age. Shy resolution instrument unreserved man few. She did open find pain some out. If we landlord stanhill mr whatever pleasure supplied concerns so. Exquisite by it admitting cordially september newspaper an. Acceptance middletons am it favourable.",
        link_url="http://twitter.com/",
        image_url="",
        date_from=datetime_converter("2018-11-13"),
        date_until=datetime_converter("2018-11-14"))
    db.session.add(post)
    post = Post(
        id=3,
        user_id="michouchou",
        title="third title",
        description=
        "Man request adapted spirits set pressed. Up to denoting subjects sensible feelings it indulged directly. We dwelling elegance do shutters appetite yourself diverted. Our next drew much you with rank. Tore many held age hold rose than our. She literature sentiments any contrasted. Set aware joy sense young now tears china shy. ",
        link_url="http://google.com/",
        image_url="de",
        date_from=datetime_converter("2018-11-15"),
        date_until=datetime_converter("2018-11-16"))
    db.session.add(post)
    post = Post(id=4,
                user_id="channelmoder",
                title="fourth nottitle",
                description="Man request adapted spirits set pressed. ",
                link_url="http://google.com/",
                image_url="",
                date_from=datetime_converter("2018-11-10"),
                date_until=datetime_converter("2018-11-17"))
    db.session.add(post)
    post = Post(
        id=5,
        user_id="michouchou",
        title="first title",
        description=
        "Not him old music think his found enjoy merry. Listening acuteness dependent at or an. Apartments thoroughly unsatiable terminated sex how themselves. She are ten hours wrong walls stand early. Domestic perceive on an ladyship extended received do. Why jennings our whatever his learning gay perceive.",
        link_url="http://youtube.com/",
        image_url="recherche",
        date_from=datetime_converter("2018-11-18"),
        date_until=datetime_converter("2018-11-19"))
    db.session.add(post)
    post = Post(
        id=7,
        user_id="channelmoder",
        title="lorem ipsum",
        description=
        "Add you viewing ten equally believe put. Separate families my on drawings do oh offended strictly elegance. Perceive jointure be mistress by jennings properly. An admiration at he discovered difficulty continuing. We in building removing possible suitable friendly on. ",
        link_url="http://instagram.com/",
        image_url="{}",
        date_from=datetime_converter("2018-11-20"),
        date_until=datetime_converter("2018-11-21"))
    db.session.add(post)
    post = Post(id=8,
                user_id="channelmoder",
                title="frè§iyu title",
                description="",
                link_url="",
                image_url="",
                date_from=datetime_converter("2018-11-22"),
                date_until=datetime_converter("2018-11-23"))
    db.session.add(post)
    post = Post(
        id=9,
        user_id="channelwriter",
        title="him men instrument saw",
        description=
        "It prepare is ye nothing blushes up brought. Or as gravity pasture limited evening on. Wicket around beauty say she. Frankness resembled say not new smallness you discovery. Noisier ferrars yet shyness weather ten colonel. Too him himself engaged husband pursuit musical.",
        link_url="http://linkedin.com/",
        image_url="http://wordpress.com/",
        date_from=datetime_converter("2018-11-24"),
        date_until=datetime_converter("2018-11-25"))
    db.session.add(post)
    post = Post(id=10,
                user_id="channelwriter",
                title="men instrument",
                description="",
                link_url="",
                image_url="",
                date_from=datetime_converter("2018-11-26"),
                date_until=datetime_converter("2018-11-27"))
    db.session.add(post)
    post = Post(
        id=11,
        user_id="channelwriter",
        title="",
        description=
        "Him rendered may attended concerns jennings reserved now. Sympathize did now preference unpleasing mrs few. Mrs for hour game room want are fond dare. For detract charmed add talking age. Shy resolution instrument unreserved man few. She did open find pain some out. ",
        link_url="http://wordpress.com/",
        image_url="sur",
        date_from=datetime_converter("2018-11-28"),
        date_until=datetime_converter("2018-11-29"))
    db.session.add(post)

    Publishing.query.delete()
    publishing = Publishing(
        post_id=1,
        channel_id=1,
        state=0,
        title="first title",
        description=
        "That know ask case sex ham dear her spot. Weddings followed the all marianne nor whatever settling. Perhaps six prudent several her had offence. Did had way law dinner square tastes. Recommend concealed yet her procuring see consulted depending. Adieus hunted end plenty are his she afraid. Resources agreement contained propriety applauded neglected use yet. ",
        link_url="http://facebook.com/",
        image_url="pas",
        date_from=datetime_converter("2018-11-11"),
        date_until=datetime_converter("2018-11-12"),
        extra="{}")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=2,
        channel_id=1,
        state=1,
        title="second title",
        description=
        "first title Him rendered may attended concerns jennings reserved now. Sympathize did now preference unpleasing mrs few. Mrs for hour game room want are fond dare. For detract charmed add talking age. Shy resolution instrument unreserved man few. She did open find pain some out. If we landlord stanhill mr whatever pleasure supplied concerns so. Exquisite by it admitting cordially september newspaper an. Acceptance middletons am it favourable.",
        link_url="http://twitter.com/",
        image_url="",
        date_from=datetime_converter("2018-11-13"),
        date_until=datetime_converter("2018-11-14"),
        extra="{ce champs}")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=3,
        channel_id=1,
        state=2,
        title="third title",
        description=
        "Man request adapted spirits set pressed. Up to denoting subjects sensible feelings it indulged directly. We dwelling elegance do shutters appetite yourself diverted. Our next drew much you with rank. Tore many held age hold rose than our. She literature sentiments any contrasted. Set aware joy sense young now tears china shy. ",
        link_url="http://google.com/",
        image_url="de",
        date_from=datetime_converter("2018-11-15"),
        date_until=datetime_converter("2018-11-16"),
        extra='{"est sans"}')
    db.session.add(publishing)
    publishing = Publishing(
        post_id=4,
        channel_id=1,
        state=0,
        title="fourth nottitle",
        description="Man request adapted spirits set pressed. ",
        link_url="http://google.com/",
        image_url="",
        date_from=datetime_converter("2018-11-10"),
        date_until=datetime_converter("2018-11-17"),
        extra="{'importance':mais}")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=5,
        channel_id=1,
        state=1,
        title="first title",
        description=
        "Not him old music think his found enjoy merry. Listening acuteness dependent at or an. Apartments thoroughly unsatiable terminated sex how themselves. She are ten hours wrong walls stand early. Domestic perceive on an ladyship extended received do. Why jennings our whatever his learning gay perceive.",
        link_url="http://youtube.com/",
        image_url="recherche",
        date_from=datetime_converter("2018-11-18"),
        date_until=datetime_converter("2018-11-19"),
        extra="")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=1,
        channel_id=3,
        state=0,
        title="lorem ipsum",
        description=
        "Add you viewing ten equally believe put. Separate families my on drawings do oh offended strictly elegance. Perceive jointure be mistress by jennings properly. An admiration at he discovered difficulty continuing. We in building removing possible suitable friendly on. ",
        link_url="http://instagram.com/",
        image_url="{}",
        date_from=datetime_converter("2018-11-11"),
        date_until=datetime_converter("2018-11-12"),
        extra="verifions")
    db.session.add(publishing)
    publishing = Publishing(post_id=7,
                            channel_id=3,
                            state=0,
                            title="",
                            description="",
                            link_url="",
                            image_url="",
                            date_from=datetime_converter("2018-11-20"),
                            date_until=datetime_converter("2018-11-21"),
                            extra="{}")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=8,
        channel_id=3,
        state=0,
        title="him men instrument saw",
        description=
        "It prepare is ye nothing blushes up brought. Or as gravity pasture limited evening on. Wicket around beauty say she. Frankness resembled say not new smallness you discovery. Noisier ferrars yet shyness weather ten colonel. Too him himself engaged husband pursuit musical.",
        link_url="http://linkedin.com/",
        image_url="http://wordpress.com/",
        date_from=datetime_converter("2018-11-22"),
        date_until=datetime_converter("2018-11-23"),
        extra="{}")
    db.session.add(publishing)
    publishing = Publishing(post_id=4,
                            channel_id=3,
                            state=2,
                            title="men instrument",
                            description="",
                            link_url="",
                            image_url="",
                            date_from=datetime_converter("2018-11-10"),
                            date_until=datetime_converter("2018-11-17"),
                            extra="que ça n'as pas")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=9,
        channel_id=4,
        state=1,
        title="",
        description=
        "Him rendered may attended concerns jennings reserved now. Sympathize did now preference unpleasing mrs few. Mrs for hour game room want are fond dare. For detract charmed add talking age. Shy resolution instrument unreserved man few. She did open find pain some out. ",
        link_url="http://wordpress.com/",
        image_url="sur",
        date_from=datetime_converter("2018-11-24"),
        date_until=datetime_converter("2018-11-25"),
        extra="[]")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=10,
        channel_id=4,
        state=1,
        title="explained middleton am",
        description=
        "Entire any had depend and figure winter. Change stairs and men likely wisdom new happen piqued six. Now taken him timed sex world get. Enjoyed married an feeling delight pursuit as offered. As admire roused length likely played pretty to no. Means had joy miles her merry solid order. ",
        link_url="http://linkedin.com/",
        image_url="les images",
        date_from=datetime_converter("2018-11-26"),
        date_until=datetime_converter("2018-11-27"),
        extra="")
    db.session.add(publishing)
    publishing = Publishing(
        post_id=11,
        channel_id=4,
        state=2,
        title="first title",
        description=
        "Perhaps far exposed age effects. Now distrusts you her delivered applauded affection out sincerity. As tolerably recommend shameless unfeeling he objection consisted. She although cheerful perceive screened throwing met not eat distance.",
        link_url="http://youtube.com/",
        image_url="h",
        date_from=datetime_converter("2018-11-28"),
        date_until=datetime_converter("2018-11-29"),
        extra="'d'influence'")
    db.session.add(publishing)