Beispiel #1
0
def channel_list():
    if request.method == "POST":
        action = request.form.get('@action', '')
        if action == "new":
            name = request.form.get('name')
            module = request.form.get('module')
            if module in get_modules_names(
                    current_app.config["PLUGINS"].keys()):
                channel = Channel(name = name,
                                  module = get_module_full_name(module),
                                  config = "{}")
                db.session.add(channel)
                db.session.commit()
        elif action == "delete":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            if channel:
                db.session.delete(channel)
                db.session.commit()
        elif action == "edit":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            name = request.form.get('name')
            channel.name = name
            db.session.commit()

    channels = Channel.query.all()
    return render_template("channels.html", channels = channels,
                           modules = get_modules_names(
                               current_app.config["PLUGINS"].keys()))
def add_channel(channel_name, module, config):
    channel = Channel()
    channel.name = channel_name
    channel.module = get_module_full_name(module)
    channel.config = config

    db.session.add(channel)
    db.session.commit()
Beispiel #3
0
def create(client):
    post = Post(user_id='myself',
                title='title_post',
                description='descr_post',
                link_url='link_post',
                image_url='image_post',
                date_from=datetime_converter('2017-06-02'),
                date_until=datetime_converter('2017-06-03'))
    db.session.add(post)
    db.session.commit()
    chan = Channel(
        name='rss',
        id=-1,
        module='superform.plugins.rss',
        config='{"feed_title": "test_title", "feed_description": "test_desc"}')
    db.session.add(chan)
    db.session.commit()
    pub = Publishing(post_id=post.id,
                     channel_id=chan.id,
                     state=0,
                     title=post.title,
                     description=post.description,
                     link_url=post.link_url,
                     image_url=post.image_url,
                     date_from=post.date_from,
                     date_until=post.date_until)
    db.session.add(pub)
    db.session.commit()

    return post, chan, pub
def prefill_db(client):
    post = Post(user_id='myself',
                title='title_post',
                description='descr_post',
                link_url='link_post',
                image_url='image_post',
                date_from=datetime_converter('2020-01-01'),
                date_until=datetime_converter('2020-01-01'))
    db.session.add(post)
    db.session.commit()
    chan = Channel(
        name='my_mail',
        id=-1,
        module='superform.plugins.mail',
        config='{"sender":"*****@*****.**", "receiver":"*****@*****.**"}')
    db.session.add(chan)
    db.session.commit()
    pub = Publishing(post_id=post.id,
                     channel_id=chan.id,
                     state=0,
                     title=post.title,
                     description=post.description,
                     link_url=post.link_url,
                     image_url=post.image_url,
                     date_from=post.date_from,
                     date_until=post.date_until)
    db.session.add(pub)
    db.session.commit()

    return post, chan, pub
Beispiel #5
0
def test_get_moderate_channels_for_user():
    u = User.query.get(1)
    channel = Channel(name="test", module=get_module_full_name("mail"), config="{}")
    db.session.add(channel)
    assert get_moderate_channels_for_user(u) is not None
    user = User(id=2, name="test", first_name="utilisateur2", email="*****@*****.**")
    db.session.add(user)
    assert len(get_moderate_channels_for_user(user)) == 0
    a = Authorization(channel_id=1, user_id=2, permission=2)
    db.session.add(a)
    assert len(get_moderate_channels_for_user(user)) == 1
Beispiel #6
0
def channel_list():
    if request.method == "POST":
        action = request.form.get('@action', '')
        if action == "new":
            name = request.form.get('name')
            username = request.form.get('username')
            password = request.form.get('password')
            module = request.form.get('module')
            if module in get_modules_names(current_app.config["PLUGINS"].keys()):
                channel = Channel(name=name, module=get_module_full_name(module), config="{}")
                db.session.add(channel)
                db.session.flush()
                db.session.commit()

        elif action == "delete":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            if channel:
                db.session.delete(channel)
                db.session.commit()
        elif action == "edit":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            name = request.form.get('name')
            username = request.form.get('username')
            password = request.form.get('password')
            if name is not '':
                channel.name = name
                conf = json.loads(channel.config)
                conf["channel_name"] = name
                channel.config = json.dumps(conf)
                db.session.commit()

    channels = Channel.query.all()
    mods = get_modules_names(current_app.config["PLUGINS"].keys())

    auth_fields = dict()


    return render_template("channels.html", channels=channels, modules=get_modules_names(current_app.config["PLUGINS"].keys()), auth_fields=auth_fields)
def channel_list():
    if request.method == "POST":
        action = request.form.get('@action', '')
        if action == "new":
            name = request.form.get('name')
            module = request.form.get('module')
            if module in get_modules_names(
                    current_app.config["PLUGINS"].keys()):
                channel = Channel(name=name,
                                  module=get_module_full_name(module),
                                  config="{}",
                                  archival_frequency=DEFAULT_FREQUENCY,
                                  archival_date=DEFAULT_DATE)
                db.session.add(channel)
                db.session.commit()
                # Archival Module :
                configure_job(channel.id, DEFAULT_FREQUENCY, DEFAULT_DATE)
                # End of Archival Module

        elif action == "delete":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            if channel:
                db.session.delete(channel)
                db.session.commit()
                # Archival Module :
                delete_job(channel_id)
                # End of Archival Module
        elif action == "edit":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            name = request.form.get('name')
            channel.name = name
            db.session.commit()

    channels = Channel.query.all()
    return render_template("channels.html",
                           channels=channels,
                           modules=get_modules_names(
                               current_app.config["PLUGINS"].keys()))
def test_search_post_valid_login(client) :
    login(client, "myself")

    channel = Channel(name="testTwitter", module=get_module_full_name("TestTwitter"), config="{}")
    db.session.add(channel)


    r = requests.post("http://127.0.0.1:5000/search_post", {
        "subject": "",
        "body": "",
        "sorted": ""
    })

    assert int(r.status_code) == 200
def test_search_unlogged_client_publishing_search(client):
    user = User(id=6, name="test", first_name="utilisateur", email="*****@*****.**")
    db.session.add(user)

    channel = Channel(name="test", module=get_module_full_name("TestTwitter"), config="{}")
    db.session.add(channel)
    a = Authorization(channel_id=1, user_id=6, permission=2)
    db.session.add(a)

    r = requests.post("http://127.0.0.1:5000/search_publishings", {
        "subject": "",
        "body": "",
        "author": "",
        "channels": "test"
    })

    assert int(r.status_code) == 403
def test_not_moderator(client) :
    user = User(id=1, name="test", first_name="utilisateur", email="*****@*****.**")
    db.session.add(user)

    channel = Channel(name="test", module=get_module_full_name("TestTwitter"), config="{}")
    db.session.add(channel)

    login(client, 1)

    r = requests.post("http://127.0.0.1:5000/search_publishings", {
        "subject": "",
        "body": "",
        "author": "",
        "channels": "test"
    })


    assert r.status_code == 403
Beispiel #11
0
def test_send_tweet_bad_config(client):
    name = "unittest_twitter"
    module = "superform.plugins.twitter"
    P = Publishing(post_id=0,channel_id=name,state=0,title='test',description='unit test')
    C = Channel(name=name, module=module, config="{}")
    db.session.add(C)
    db.session.add(P)
    db.session.commit()
    pub = db.session.query(Publishing).filter(Publishing.post_id == 0, Publishing.channel_id == name).first()
    c = db.session.query(Channel).filter(Channel.name == pub.channel_id).first()
    temp_stdout = StringIO()
    with contextlib.redirect_stdout(temp_stdout):
        twitter.run(pub,c.config)
    output = temp_stdout.getvalue().strip()
    db.session.query(Publishing).filter(Publishing.post_id == 0).delete()
    db.session.query(Channel).filter(Channel.name == name).delete()
    db.session.commit()
    assert 'Missing' in output
def test_logged_but_not_moderator(client) :
    login(client, "myself")
    rv2 = client.get('/', follow_redirects=True)
    assert rv2.status_code == 200
    assert "Your are not logged in." not in rv2.data.decode()

    channel = Channel(name="test", module=get_module_full_name("TestTwitter"), config="{}")
    db.session.add(channel)
    filter = {}
    filter["subject"] = " "
    filter["sorted"] = "id"
    filter["body"] = " "
    headers ={}
    headers["Content-Type"] = "application/json"
    headers["Data-Type"] = "json"
    headers["Accept"] = "application/json"
    r = requests.post("http://127.0.0.1:5000/search_post",headers=headers, data=json.dumps(filter))
    assert r.status_code==200
Beispiel #13
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
Beispiel #14
0
def prefill_db(client, name, module):
    chan = Channel(name=name, id=-1, module=module, config='')
    db.session.add(chan)
    db.session.commit()
    return chan
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
import os
import tempfile
import json
import pytest
import urllib.error

from urllib.parse import urlencode
from urllib.request import Request, urlopen
from superform import app, db
from superform.models import Channel

new_channel_config = "{\"Author\": \"myself\", \"Wiki's url\": \"http://localhost:8001/pmwiki.php\", \"Publication's group\": \"Test\"}"
channel = Channel(name="newWikiChannel",
                  module="superform.plugins.wiki",
                  config=new_channel_config)


@pytest.fixture
def client():
    app.app_context().push()
    db_fd, app.config['DATABASE'] = tempfile.mkstemp()
    app.config['TESTING'] = True
    client = app.test_client()
    with app.app_context():
        db.create_all()
    yield client
    os.close(db_fd)
    os.unlink(app.config['DATABASE'])


def test_wiki_create(client):
def channel_list():
    if request.method == "POST":
        action = request.form.get('@action', '')
        if action == "new":
            name = request.form.get('name')
            username = request.form.get('username')
            password = request.form.get('password')
            module = request.form.get('module')
            if module in get_modules_names(
                    current_app.config["PLUGINS"].keys()):
                channel = Channel(name=name,
                                  module=get_module_full_name(module),
                                  config="{}")
                db.session.add(channel)
                db.session.flush()
                keepass.set_entry_from_data(str(channel.id), username,
                                            password)
                keepass.add_entry_in_group(module)
                db.session.commit()

        elif action == "delete":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            if channel:
                db.session.delete(channel)
                db.session.commit()
                keepass.delete_entry(channel_id)
        elif action == "edit":
            channel_id = request.form.get("id")
            channel = Channel.query.get(channel_id)
            name = request.form.get('name')
            username = request.form.get('username')
            password = request.form.get('password')
            if name is not '':
                channel.name = name
                conf = json.loads(channel.config)
                conf["channel_name"] = name
                channel.config = json.dumps(conf)
                db.session.commit()
            if username is not '' or password is not '':
                keepass.set_entry_from_data(str(channel.id), username,
                                            password)
                keepass.modify_entry_in_group(
                    get_modules_names([channel.module])[0], channel.id)

    channels = Channel.query.all()
    mods = get_modules_names(current_app.config["PLUGINS"].keys())

    auth_fields = dict()

    for m in mods:
        full_name = get_module_full_name(m)
        clas = get_instance_from_module_path(full_name)
        fields = clas.AUTH_FIELDS
        auth_fields[m] = fields

    return render_template("channels.html",
                           channels=channels,
                           modules=get_modules_names(
                               current_app.config["PLUGINS"].keys()),
                           auth_fields=auth_fields)
def create_channel(name, module, config):
    channel = Channel(name=name,
                      module=get_module_full_name(module),
                      config=json.dumps(config))
    write_to_db(channel)
    return channel
Beispiel #19
0
def test_edit_new_publishing(client):
    login(client, "myself")
    channel = Channel(id=0,
                      name="test",
                      module=get_module_full_name("mail"),
                      config="{}")
    db.session.add(channel)
    a = Authorization(channel_id=channel.id, user_id="myself", permission=1)
    db.session.add(a)
    db.session.commit()
    datadict = dict(titlepost='A new test post',
                    descriptionpost="A description",
                    linkurlpost="http://www.test.com",
                    imagepost="image.jpg",
                    datefrompost="2018-07-01",
                    dateuntilpost="2018-07-01")
    datadict[str(channel.name) + '_titlepost'] = "mail title"
    datadict[str(channel.name) + '_descriptionpost'] = 'mail description'
    datadict[str(channel.name) + '_linkurlpost'] = "http://www.test.com"
    datadict[str(channel.name) + '_imagepost'] = "image.jpg"
    datadict[str(channel.name) + '_datefrompost'] = "2018-07-01"
    datadict[str(channel.name) + '_dateuntilpost'] = "2018-07-01"
    rv = client.post('/new', data=datadict)
    assert rv.status_code == 302
    posts = db.session.query(Post).all()
    last_add = posts[-1]
    url = '/edit/publish_edit_post/' + str(last_add.id)
    datadict2 = dict(title='An edited test post',
                     description="A description",
                     link_url="http://www.test.com",
                     image="image.jpg",
                     date_from="2018-07-01",
                     date_until="2018-07-01")
    datadict3 = dict(title='mail title',
                     description='edited mail description',
                     date_from="2018-07-01",
                     date_until="2018-07-01")
    rv = client.post(url,
                     data=json.dumps([{
                         "name": "General",
                         "fields": datadict2
                     }, {
                         "name": "test",
                         "fields": datadict3
                     }]))
    assert rv.status_code == 200
    edited_posts = db.session.query(Post).all()
    assert len(posts) == len(edited_posts)
    edited_post = edited_posts[-1]
    assert edited_post.title == 'An edited test post'
    assert last_add.id == edited_post.id
    assert edited_post.description == "A description"
    edited_publishing = db.session.query(Publishing).filter(
        Publishing.post_id == last_add.id)
    assert edited_publishing[0].title == "mail title"
    assert edited_publishing[0].description == "edited mail description"
    # cleaning up
    db.session.query(Post).filter(Post.id == last_add.id).delete()
    db.session.query(Publishing).filter(
        Publishing.post_id == last_add.id).delete()
    db.session.delete(a)
    db.session.delete(channel)
    db.session.commit()
Beispiel #20
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)