def create_a_resubmit_publishing(pub, chn, form): validate = pre_validate_post(chn, pub) if validate == -1 or validate == 0: return validate title_post = form.get('titlepost') descr_post = form.get('descrpost') link_post = form.get('linkurlpost') image_post = form.get('imagepost') if chn.module == 'superform.plugins.gcal': pub.date_start = datetime_converter(form.get('datedebut')) pub.hour_start = form.get('heuredebut') pub.date_end = datetime_converter(form.get('datefin')) pub.hour_end = form.get('heurefin') pub.location = form.get('location') pub.color = form.get('color') pub.visibility = form.get('visibility') pub.availability = form.get('availability') else: date_from = datetime_converter(form.get('datefrompost')) date_until = datetime_converter(form.get('dateuntilpost')) latest_version_publishing = db.session.query(Publishing).filter(Publishing.post_id == pub.post_id, Publishing.channel_id == chn.id).order_by( Publishing.num_version.desc() ).first() new_pub = Publishing(num_version=latest_version_publishing.num_version + 1, post_id=pub.post_id, channel_id=chn.id, state=State.NOT_VALIDATED.value, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until) return new_pub
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 create_a_publishing(post, chn, form): chan = str(chn.name) title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title descr_post = form.get(chan + '_descriptionpost') if form.get( chan + '_descriptionpost') is not None else post.description link_post = form.get(chan + '_linkurlpost') if form.get( chan + '_linkurlpost') is not None else post.link_url image_post = form.get(chan + '_imagepost') if form.get( chan + '_imagepost') is not None else post.image_url date_from = datetime_converter( form.get(chan + '_datefrompost')) if datetime_converter( form.get(chan + '_datefrompost')) is not None else post.date_from date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if datetime_converter( form.get(chan + '_dateuntilpost')) is not None else post.date_until pub = Publishing(post_id=post.id, channel_id=chn.id, 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(pub) db.session.commit() return 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
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()
def create_a_publishing_edit(post, chn, data): """ This method is used in publish_edit_post in order to generate a publication. Since the request used in publish_edit_post is different than the request in create_a_publishing in post.py, this methode had the same behaviour but instead of using a request.form we use a request.get_json :param post : the post linked to the publication, chn : the channel used for the publication, data : data used to make the publishing :return: the publishing """ field = data.get('fields') title_post = field.get('title') if (field.get('title') is not None) else post.title descr_post = field.get('description') if field.get('description') is not None else post.description link_post = field.get('link_url') if field.get('link_url') is not None else post.link_url image_post = field.get('image_url') if field.get('image_url') is not None else post.image_url if field.get('date_from') is '': date_from = date.today() else: date_from = datetime_converter(field.get('date_from')) if datetime_converter( field.get('date_from')) is not None else post.date_from if field.get('date_until') is '': date_until = date.today() + timedelta(days=7) else: date_until = datetime_converter(field.get('date_until')) if datetime_converter( field.get('date_until')) is not None else post.date_until if chn.module == 'superform.plugins.ICTV': logo = field.get('logo') subtitle = field.get('subtitle') duration = field.get('duration') pub = Publishing(user_id=session.get("user_id", ""), post_id=post.id, channel_id=chn.id, state=State.NOT_VALIDATED.value, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, logo=logo, subtitle=subtitle, duration=duration) else: pub = Publishing(user_id=session.get("user_id", ""), post_id=post.id, channel_id=chn.id, state=State.NOT_VALIDATED.value, 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(pub) db.session.commit() return pub
def test_publish_link(client): new_publish = Publishing( title="Coucou", description="J'aime faire des tests unitaires", link_url="https://docs.pytest.org/en/latest/index.html") assert fb.get_link( new_publish) == "https://docs.pytest.org/en/latest/index.html"
def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title run(myPub, channel_config) return redirect(url_for('index'))
def create_a_publishing(post, chn, form): chan = str(chn.name) plug_name = chn.module from importlib import import_module plug = import_module(plug_name) if 'forge_link_url' in dir(plug): link_post = plug.forge_link_url(chan, form) else: link_post = form.get(chan + '_linkurlpost') if form.get( chan + '_linkurlpost') is not None else post.link_url title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title descr_post = form.get(chan + '_descriptionpost') if form.get( chan + '_descriptionpost') is not None else post.description rss_feed = form.get(chan + '_linkrssfeedpost') image_post = form.get(chan + '_imagepost') if form.get( chan + '_imagepost') is not None else post.image_url date_from = datetime_converter( form.get(chan + '_datefrompost')) if form.get( chan + '_datefrompost') is not None else post.date_from time_from = time_converter(form.get(chan + '_timefrompost')) if form.get( chan + '_timefrompost') is not None else None if date_from and time_from: date_from = date_from.replace(hour=time_from.hour, minute=time_from.minute) date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if form.get( chan + '_dateuntilpost') is not None else post.date_until time_until = time_converter(form.get(chan + '_timeuntilpost')) if form.get( chan + '_timeuntilpost') is not None else None if date_until and time_until: date_until = date_until.replace(hour=time_until.hour, minute=time_until.minute) pub = Publishing(post_id=post.id, channel_id=chn.id, state=State.NOTVALIDATED.value, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, rss_feed=rss_feed) db.session.add(pub) db.session.commit() return pub
def create_a_publishing(post, chn, form): chan = str(chn.name) title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title chn.count += 1 # TODO (team02) find utility user_id = session.get("user_id", "") if session.get("logged_in", False) else -1 if "twitter" in chn.module: descr_post = form.get('tweets') elif form.get(chan + '_descriptionpost') is not None : descr_post = form.get(chan + '_descriptionpost') else : descr_post = post.description link_post = form.get(chan + '_linkurlpost') if form.get(chan + '_linkurlpost') is not None else post.link_url image_post = form.get(chan + '_imagepost') if form.get(chan + '_imagepost') is not None else post.image_url date_from = datetime_converter(form.get(chan + '_datefrompost')) if datetime_converter( form.get(chan + '_datefrompost')) is not None else post.date_from date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if datetime_converter( form.get(chan + '_dateuntilpost')) is not None else post.date_until pub = Publishing(post_id=post.id, user_id=user_id, channel_id=chn.id, state=0, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until) c = db.session.query(Channel).filter( Channel.id == pub.channel_id).first() if c is not None: plugin_name = c.module ##If it is a pdf chanel we don't need to save it, printing it would be enough # TEAM6: MODIFICATION FOR PDF if str(plugin_name).endswith("pdf"): c_conf = c.config from importlib import import_module plugin = import_module(plugin_name) plugin.run(pub, c_conf) # Does not save the pdf posts return pub # END OF MODIFICATION if is_gcal_channel(chan) and not gcal_plugin.is_valid(pub): return None if is_gcal_channel(chan): generate_google_user_credentials(chan) db.session.add(pub) db.session.commit() return pub
def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title run(myPub, channel_config) # TODO get the post information # db.session... TODO # pub = {'description': post.description, 'title': post.title} TODO # config = TODO # run(publishing = pub, channel_config = config) return redirect(url_for('index'))
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'))
def create_a_resubmit_publishing(pub, chn, form): user_id = session.get("user_id", "") if session.get("logged_in", False) else -1 title_post = form.get('titlepost') descr_post = form.get('descrpost') link_post = form.get('linkurlpost') image_post = form.get('imagepost') date_from = datetime_converter(form.get('datefrompost')) date_until = datetime_converter(form.get('dateuntilpost')) start_hour = time_converter(form.get('starthour')) end_hour = time_converter(form.get('endhour')) latest_version_publishing = db.session.query(Publishing).filter(Publishing.post_id == pub.post_id, Publishing.channel_id == chn.id).order_by( Publishing.num_version.desc() ).first() new_pub = Publishing(num_version=latest_version_publishing.num_version + 1, post_id=pub.post_id, channel_id=chn.id, state=State.NOT_VALIDATED.value, 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) return new_pub
def create_a_publishing(post, chn, form): chan = str(chn.name) title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title descr_post = form.get(chan + '_descriptionpost') if form.get( chan + '_descriptionpost') is not None else post.description link_post = form.get(chan + '_linkurlpost') if form.get( chan + '_linkurlpost') is not None else post.link_url image_post = form.get(chan + '_imagepost') if form.get( chan + '_imagepost') is not None else post.image_url date_from = datetime_converter( form.get(chan + '_datefrompost')) if datetime_converter( form.get(chan + '_datefrompost')) is not None else post.date_from date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if datetime_converter( form.get(chan + '_dateuntilpost')) is not None else post.date_until extra = dict() plugin_name = chn.module from importlib import import_module plugin = import_module(plugin_name) if 'get_channel_fields' in dir(plugin): extra = plugin.get_channel_fields(form, chan) pub = Publishing(post_id=post.id, channel_id=chn.id, state=0, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, extra=json.dumps(extra)) db.session.add(pub) db.session.commit() return pub
def export(post_id, idc): pdf_Channel = db.session.query(Channel).filter(Channel.id == idc).first() if pdf_Channel is not None: channel_config = pdf_Channel.config else: flash("PDF channel not found", category='success') return redirect(url_for('index')) myPost = db.session.query(Post).filter(Post.id == post_id).first() myPub = Publishing() myPub.description = myPost.description myPub.title = myPost.title code = run(myPub, channel_config) if code[0].value != StatusCode.OK.value: flash(code[1], category='error') return redirect(url_for('index')) else: # flash("The PDF has successfully been generated.", category='success') return send_from_directory("plugins/pdf/", code[1], as_attachment=True, attachment_filename=code[1])
def create_a_publishing(post, chn, form): chan = str(chn.name) title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title descr_post = form.get(chan + '_descriptionpost') if form.get( chan + '_descriptionpost') is not None else post.description plugin = import_module(chn.module) if "saveExtraFields" in vars(plugin): misc_post = plugin.saveExtraFields( chan, form) # plugin will handle extra fields here link_post = form.get(chan + '_linkurlpost') if form.get( chan + '_linkurlpost') is not None else post.link_url image_post = form.get(chan + '_imagepost') if form.get( chan + '_imagepost') is not None else post.image_url date_from = datetime_converter( form.get(chan + '_datefrompost')) if datetime_converter( form.get(chan + '_datefrompost')) is not None else post.date_from date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if datetime_converter( form.get(chan + '_dateuntilpost')) is not None else post.date_until pub = Publishing(post_id=post.id, channel_id=chn.id, state=0, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, misc=misc_post) db.session.add(pub) db.session.commit() return pub
def create_a_publishing(post, chn, form): # called in publish_from_new_post() chan = str(chn.name) plug = import_module(chn.module) title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title # Team2 stat chn.count += 1 user_id = session.get("user_id", "") if session.get("logged_in", False) else -1 # Team2 stat # TEAM 10 twitter if "twitter" in chn.module: descr_post = form.get('tweets') elif form.get(chan + '_descriptionpost') is not None: descr_post = form.get(chan + '_descriptionpost') else: descr_post = post.description # TEAM 10 twitter # TEAM 3 ictv if 'forge_link_url' in dir(plug): link_post = plug.forge_link_url(chan, form) else: link_post = form.get(chan + '_linkurlpost') if form.get( chan + '_linkurlpost') is not None else post.link_url # TEAM 3 ictv image_post = form.get(chan + '_imagepost') if form.get( chan + '_imagepost') is not None else post.image_url if form.get(chan + '_datefrompost') is '': date_from = date.today() else: date_from = datetime_converter( form.get(chan + '_datefrompost')) if form.get( chan + '_datefrompost') is not None else post.date_from if form.get(chan + '_dateuntilpost') is '': date_until = date.today() + timedelta(days=7) else: date_until = datetime_converter( form.get(chan + '_dateuntilpost')) if form.get( chan + '_datefrompost') is not None else post.date_until if form.get(chan + '_starthour') is '': start_hour = time_converter("00:00") else: start_hour = time_converter(form.get(chan + '_starthour')) if form.get( chan + '_starthour') is not None else post.start_hour if form.get(chan + '_endhour') is '': end_hour = time_converter("23:59") else: end_hour = time_converter(form.get(chan + '_endhour')) if form.get( chan + '_endhour') is not None else post.end_hour latest_version_publishing = db.session.query(Publishing).filter( Publishing.post_id == post.id, Publishing.channel_id == chn.id).order_by( Publishing.num_version.desc()).first() version_number = 1 if latest_version_publishing is None else latest_version_publishing.num_version + 1 pub = Publishing(num_version=version_number, post_id=post.id, user_id=user_id, channel_id=chn.id, state=State.NOT_VALIDATED.value, 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) # TEAM6: MODIFICATION FOR PDF c = db.session.query(Channel).filter(Channel.id == pub.channel_id).first() if c is not None: plugin_name = c.module # If it is a pdf chanel we don't need to save it, printing it would be enough if str(plugin_name).endswith("pdf"): c_conf = c.config plugin = import_module(plugin_name) plugin.run(pub, c_conf) # Does not save the pdf posts return pub # TEAM6: END OF MODIFICATION db.session.add(pub) db.session.commit() if latest_version_publishing is None: user_comment = "" date_user_comment = str_converter_with_hour(datetime_now()) comm = Comment(publishing_id=pub.publishing_id, user_comment=user_comment, date_user_comment=date_user_comment) db.session.add(comm) db.session.commit() return pub
def test_moderate(client): id_channel, id_post = pytest.helpers.plugin.setup_db( channelName, "superform.plugins.Twitter") driver = webdriver.Firefox() try: driver.get('http://localhost:5000/') wait = WebDriverWait(driver, 20) driver.find_element_by_link_text("Login").click() wait.until(EC.element_to_be_clickable((By.NAME, "j_username"))) driver.find_element_by_name("j_username").click() driver.find_element_by_name("j_username").clear() driver.find_element_by_name("j_username").send_keys("myself") driver.find_element_by_name("j_password").click() driver.find_element_by_name("j_password").clear() driver.find_element_by_name("j_password").send_keys("myself") driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='Password:'******'New post'))) driver.find_element_by_link_text("New post").click() driver.find_element_by_id("chan_option_" + str(id_channel)).click() driver.find_element_by_id("descriptionpost").click() driver.find_element_by_id("descriptionpost").click() driver.find_element_by_id("descriptionpost").clear() driver.find_element_by_id("descriptionpost").send_keys( "An duis ubique mei, amet commodo dignissim ne eam, vide velit adipiscing est ad. Has eu inani gloriatur. Ius ea zril malorum aliquid. Et pri deleniti euripidis adversarium. Cum hinc putant laoreet ei, ea ullum tamquam vis, cu quo modus ignota officiis.\n\nEum ea nulla exerci, paulo dolore recusabo mel et. Per altera salutatus ad. Cu veri dicat has. Ex erant viris vis, id senserit interesset referrentur nec. Periculis salutatus reformidans eam an, eum te aliquid probatus, no ius corpora petentium." ) driver.find_element_by_id("linkurlpost").click() driver.find_element_by_id("linkurlpost").clear() driver.find_element_by_id("linkurlpost").send_keys( "http://localhost:5000/new") driver.find_element_by_id("datefrompost").click() driver.find_element_by_id("datefrompost").clear() driver.find_element_by_id("datefrompost").send_keys("2020-11-21") driver.find_element_by_id("dateuntilpost").click() driver.find_element_by_id("dateuntilpost").clear() driver.find_element_by_id("dateuntilpost").send_keys("2021-01-29") driver.find_element_by_link_text(channelName).click() extra = get_channel_fields( { 'Twitter_test_tweet_1': driver.find_element_by_id(channelName + "_tweet_1").get_attribute("value"), 'Twitter_test_tweet_2': driver.find_element_by_id(channelName + "_tweet_2").get_attribute("value") }, 'Twitter_test') pub = Publishing( post_id=id_post, channel_id=id_channel, state=0, 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://localhost:5000/new", image_url="pas", date_from=datetime_converter("2018-07-01"), date_until=datetime_converter("2018-07-01"), extra=json.dumps(extra)) db.session.add(pub) db.session.commit() driver.get('http://localhost:5000/') # wait.until(EC.element_to_be_clickable((By.ID, "moderate_" + str(id_channel)))) driver.find_element_by_id("moderate_" + str(id_post)).click() driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='(264 out of 280 characters)'])[1]/following::input[2]" ).click() driver.find_element_by_id("tweet_3").click() driver.find_element_by_id("tweet_3").clear() driver.find_element_by_id("tweet_3").send_keys( "some random text to test") driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='(24 out of 280 characters)'])[1]/following::input[2]" ).click() driver.find_element_by_id("tweet_4").click() driver.find_element_by_id("tweet_4").clear() driver.find_element_by_id("tweet_4").send_keys("uiocfzuo") driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='Moderate this publication'])[1]/following::div[2]" ).click() driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='(8 out of 280 characters)'])[1]/following::input[1]" ).click() # sleep(5) print(driver.find_element_by_id("tweet_1").get_attribute("value")) assert driver.find_element_by_id("tweet_1").get_attribute( "value" ) == "[1/2] An duis ubique mei, amet commodo dignissim ne eam, vide velit adipiscing est ad. Has eu inani gloriatur. Ius ea zril malorum aliquid. Et pri deleniti euripidis adversarium. Cum hinc putant laoreet ei, ea ullum tamquam vis, cu quo modus ignota officiis.\n\nEum ea nulla…" assert driver.find_element_by_id("tweet_2").get_attribute( "value" ) == "[2/2] exerci, paulo dolore recusabo mel et. Per altera salutatus ad. Cu veri dicat has. Ex erant viris vis, id senserit interesset referrentur nec. Periculis salutatus reformidans eam an, eum te aliquid probatus, no ius corpora petentium. http://localhost:5000/new" assert driver.find_element_by_id("tweet_3").get_attribute( "value") == "some random text to test" try: driver.find_element_by_id(channelName + "_tweet_4") assert False except selenium.common.exceptions.NoSuchElementException: assert True except AssertionError as e: pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close() assert False, str(e) except InvalidRequestError as e: pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close() assert False, "An error occurred while testing: {}".format(str(e)) pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close()
def create_a_publishing(post, chn, form): # called in publish_from_new_post() chan = str(chn.name) validate = pre_validate_post(chn, post) if validate == -1 or validate == 0: return validate title_post = form.get(chan + '_titlepost') if (form.get(chan + '_titlepost') is not None) else post.title descr_post = form.get(chan + '_descriptionpost') if form.get( chan + '_descriptionpost') is not None else post.description link_post = form.get(chan + '_linkurlpost') if form.get(chan + '_linkurlpost') is not None else post.link_url image_post = form.get(chan + '_imagepost') if form.get(chan + '_imagepost') is not None else post.image_url plugin = import_module(chn.module) if "saveExtraFields" in vars(plugin): misc_post = plugin.saveExtraFields(chan, form) # plugin will handle extra fields here if form.get(chan + 'datefrompost') is '': date_from = date.today() else: date_from = datetime_converter(form.get(chan + '_datefrompost')) if datetime_converter( form.get(chan + '_datefrompost')) is not None else post.date_from if form.get(chan + 'dateuntilpost') is '': date_until = date.today() + timedelta(days=7) else: date_until = datetime_converter(form.get(chan + '_dateuntilpost')) if datetime_converter( form.get(chan + '_dateuntilpost')) is not None else post.date_until if chn.module == 'superform.plugins.ICTV': logo = form.get(chan + '_logo') subtitle = form.get(chan + '_subtitle') duration = form.get(chan + '_duration') pub = Publishing(post_id=post.id, channel_id=chn.id, state=0, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, logo=logo, subtitle=subtitle, duration=duration) db.session.add(pub) db.session.commit() else: latest_version_publishing = db.session.query(Publishing).filter(Publishing.post_id == post.id, Publishing.channel_id == chn.id).order_by( Publishing.num_version.desc()).first() if latest_version_publishing is None: pub = Publishing(post_id=post.id, channel_id=chn.id, state=State.NOT_VALIDATED.value, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, misc=misc_post) db.session.add(pub) db.session.commit() user_comment = "" date_user_comment = str_converter_with_hour(datetime_now()) comm = Comment(publishing_id=pub.publishing_id, user_comment=user_comment, date_user_comment=date_user_comment) db.session.add(comm) db.session.commit() else: pub = Publishing(num_version=latest_version_publishing.num_version + 1, post_id=post.id, channel_id=chn.id, state=State.NOT_VALIDATED.value, title=title_post, description=descr_post, link_url=link_post, image_url=image_post, date_from=date_from, date_until=date_until, misc=misc_post) db.session.add(pub) db.session.commit() return pub
def test_basic_warning2(client): id_channel, id_post = pytest.helpers.plugin.setup_db( channelName, pluginName) driver = webdriver.Firefox() try: driver.get('http://localhost:5000/') wait = WebDriverWait(driver, 10) driver.find_element_by_link_text("Login").click() driver.find_element_by_name("j_username").click() driver.find_element_by_name("j_username").clear() driver.find_element_by_name("j_username").send_keys("myself") driver.find_element_by_name("j_password").click() driver.find_element_by_name("j_password").clear() driver.find_element_by_name("j_password").send_keys("myself") driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='Password:'******'channel name'])[1]/following::button[1]" ).click() wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'New post'))) driver.find_element_by_link_text("New post").click() driver.find_element_by_id("chan_option_" + str(id_channel)).click() driver.find_element_by_id("titlepost").click() driver.find_element_by_id("titlepost").clear() driver.find_element_by_id("titlepost").send_keys("Test") driver.find_element_by_id("descriptionpost").click() driver.find_element_by_id("descriptionpost").clear() driver.find_element_by_id("descriptionpost").send_keys("Frontend") driver.find_element_by_id("linkurlpost").click() driver.find_element_by_id("linkurlpost").clear() driver.find_element_by_id("linkurlpost").send_keys( "http://localhost:5000/new") driver.find_element_by_id("datefrompost").click() driver.find_element_by_id("datefrompost").clear() driver.find_element_by_id("datefrompost").send_keys("2020-11-21") driver.find_element_by_id("dateuntilpost").click() driver.find_element_by_id("dateuntilpost").clear() driver.find_element_by_id("dateuntilpost").send_keys("2021-01-29") driver.find_element_by_link_text(channelName).click() extra = {} pub = Publishing( post_id=id_post, channel_id=id_channel, state=0, title=driver.find_element_by_id( channelName + "_titlepost").get_attribute("value"), description=driver.find_element_by_id( channelName + "_descriptionpost").get_attribute("value"), link_url=driver.find_element_by_id( channelName + "_linkurlpost").get_attribute("value"), image_url="pas", date_from=datetime_converter("2050-07-01"), date_until=datetime_converter("2050-07-01"), extra=json.dumps(extra)) db.session.add(pub) db.session.commit() driver.get('http://localhost:5000/') # wait.until(EC.element_to_be_clickable((By.ID, "moderate_" + str(id_channel)))) driver.find_element_by_id("moderate_" + str(id_post)).click() driver.find_element_by_id("pub-button").click() assert driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='Moderate this publication'])[1]/following::div[1]" ).text == "Warning!: Channel not found, please review your configuration" except AssertionError as e: pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close() assert False, str(e) except InvalidRequestError as e: pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close() assert False, "An error occurred while testing: {}".format(str(e)) pytest.helpers.plugin.teardown_db(id_channel, id_post) driver.close()
def test_basic_publish(client, channelName, pluginName, configuration, extra): id_channel, id_post = setup_db(channelName, pluginName) driver = webdriver.Firefox() try: driver.get('http://localhost:5000/') wait = WebDriverWait(driver, 10) driver.find_element_by_link_text("Login").click() driver.find_element_by_name("j_username").click() driver.find_element_by_name("j_username").clear() driver.find_element_by_name("j_username").send_keys("myself") driver.find_element_by_name("j_password").click() driver.find_element_by_name("j_password").clear() driver.find_element_by_name("j_password").send_keys("myself") driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='Password:'******'http://localhost:5000/') wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "Channels"))) driver.find_element_by_link_text("Channels").click() driver.find_element_by_link_text("Configure").click() for key in configuration: driver.find_element_by_id(key).click() driver.find_element_by_id(key).clear() driver.find_element_by_id(key).send_keys(configuration[key]) driver.find_element_by_xpath( "(.//*[normalize-space(text()) and normalize-space(.)='" + list(configuration.keys())[-1] + "'])[1]/following::button[1]").click() wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'New post'))) driver.find_element_by_link_text("New post").click() driver.find_element_by_id("chan_option_" + str(id_channel)).click() driver.find_element_by_id("titlepost").click() driver.find_element_by_id("titlepost").clear() driver.find_element_by_id("titlepost").send_keys("Test") driver.find_element_by_id("descriptionpost").click() driver.find_element_by_id("descriptionpost").clear() driver.find_element_by_id("descriptionpost").send_keys("Frontend") driver.find_element_by_id("linkurlpost").click() driver.find_element_by_id("linkurlpost").clear() driver.find_element_by_id("linkurlpost").send_keys( "http://localhost:5000/new") driver.find_element_by_id("datefrompost").click() driver.find_element_by_id("datefrompost").clear() driver.find_element_by_id("datefrompost").send_keys("2020-11-21") driver.find_element_by_id("dateuntilpost").click() driver.find_element_by_id("dateuntilpost").clear() driver.find_element_by_id("dateuntilpost").send_keys("2021-01-29") driver.find_element_by_link_text(channelName).click() pub = Publishing( post_id=id_post, channel_id=id_channel, state=0, title=driver.find_element_by_id( channelName + "_titlepost").get_attribute("value"), description=driver.find_element_by_id( channelName + "_descriptionpost").get_attribute("value"), link_url=driver.find_element_by_id( channelName + "_linkurlpost").get_attribute("value"), image_url="pas", date_from=datetime_converter("2050-07-01"), date_until=datetime_converter("2050-07-01"), extra=json.dumps(extra)) db.session.add(pub) db.session.commit() driver.get('http://localhost:5000/') # wait.until(EC.element_to_be_clickable((By.ID, "moderate_" + str(id_channel)))) driver.find_element_by_id("moderate_" + str(id_post)).click() driver.find_element_by_id("pub-button").click() assert driver.title == 'Index - Superform', driver.title except AssertionError as e: teardown_db(id_channel, id_post) driver.close() assert False, str(e) except InvalidRequestError as e: teardown_db(id_channel, id_post) driver.close() assert False, "An error occurred while testing: {}".format(str(e)) teardown_db(id_channel, id_post) driver.close()
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
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)