def test_add_post_gcal_empty_ending_date(): title = 'test_gcal title' description = 'test_gcal description' selenium_utils.add_new_post(pytest.driver, ['test_gcal'], title, description, pytest.now, '') assert "Internal Server Error" in pytest.driver.title
def test_resubmit_post(): title = 'test_linkedin_sjs' description = 'test_linkedin descriptiondss' selenium_utils.add_new_post(pytest.driver, ['test_linkedin'], title, description, pytest.now, pytest.now, 'https://www.google.be/') #TO DO pytest.driver.get(selenium_utils.moderate_url) assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/4/1"]') selenium_utils.moderate_post_with_reject(pytest.driver, 1, 4, "your post not good") #check that the post have been really refused assert not pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/4/1"]') pytest.driver.get(selenium_utils.index_url) assert pytest.driver.find_elements_by_css_selector( 'a[href="/publishing/resubmit/5"]') selenium_utils.resubmit_post(pytest.driver, 5, "oups i forgot") #check that the post is in the posts to be moderated again pytest.driver.get(selenium_utils.moderate_url) assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/4/1"]')
def test_add_post_rss_empty_begining_date(): title = 'test_rss title' description = 'test_rss description' selenium_utils.add_new_post(pytest.driver, ['test_rss'], title, description, '', pytest.now) assert "Internal Server Error" in pytest.driver.title
def test_add_post_linkedin_wrong_description(): title = 'test_linkedin title' description = "x" * (pytest.linkedin_description_max + 1) selenium_utils.add_new_post(pytest.driver, ['test_linkedin'], title, description, pytest.now, pytest.now) assert pytest.driver.find_elements_by_css_selector( 'div[id="error_test_linkedin_descriptionpost"]')
def test_add_post_slack_empty_description(): title = 'test_slack title' description = '' selenium_utils.add_new_post(pytest.driver, ['test_slack'], title, description, pytest.now, pytest.now) assert pytest.driver.find_elements_by_css_selector( 'div[id="error_test_slack_descriptionpost"]')
def test_add_post_linkedin_empty_title(): title = '' description = 'test_slack description' selenium_utils.add_new_post(pytest.driver, ['test_linkedin'], title, description, pytest.now, pytest.now) assert pytest.driver.find_elements_by_css_selector( 'div[id="error_test_linkedin_titlepost"]')
def test_ictv_post(client): title = 'test_ictv titre 1' description = 'test_edit description' selenium_utils.add_new_post(pytest.driver, [ICTV_NAME], title, description, pytest.now, pytest.now) sleep(1) posts = db.session.query(Post).all() assert len(posts) > 0 post = posts[-1]
def test_add_post_rss_2(): title = 'test_rss title 2' description = 'test_rss description 2' selenium_utils.add_new_post(pytest.driver, ['test_rss'], title, description, pytest.now, pytest.now, 'https://www.google.be/') pytest.driver.get(selenium_utils.index_url) assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/2/1"]')
def test_add_post_slack_wrong_begining_ending_date(): title = 'test_slack title' description = 'test_slack description' end_date = datetime.datetime.now() - datetime.timedelta(days=2) selenium_utils.add_new_post(pytest.driver, ['test_slack'], title, description, pytest.now, end_date.strftime("%d%m%Y")) assert pytest.driver.find_elements_by_css_selector( 'div[id="error_test_slack_dateuntilpost"]')
def test_add_post_slack(client): title = 'test_slack title' description = 'test_slack description' selenium_utils.add_new_post(pytest.driver, ['test_slack'], title, description, pytest.now, pytest.now, 'https://www.google.be/') pytest.driver.get(selenium_utils.moderate_url) posts = db.session.query(Post).all() last = posts[-1] assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/' + str(last.id) + '/' + str(pytest.slack_channel_id) + '"]')
def test_add_post_linkedin_slack(): title = 'test_linkedin_slack title' description = 'test_linkedin_slack description' selenium_utils.add_new_post(pytest.driver, ['test_linkedin', 'test_slack'], title, description, pytest.now, pytest.now, 'https://www.google.be/') pytest.driver.get(selenium_utils.moderate_url) assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/3/1"]') assert pytest.driver.find_elements_by_css_selector( 'a[href="/moderate/3/2"]')
def test_add_post_slack_wrong_link(): title = 'test_linkedin title' description = 'test_linkedin description' link = 'test' selenium_utils.add_new_post(pytest.driver, ['test_slack'], title, description, pytest.now, pytest.now, link=link) assert pytest.driver.find_elements_by_css_selector( 'div[id="error_test_slack_linkurlpost"]')
def test_edit_post(client): title = 'test_edit titre 1' description = 'test_edit description' selenium_utils.add_new_post(pytest.driver, [TWITTER_NAME], title, description, pytest.now, pytest.now) sleep(1) posts = db.session.query(Post).all() assert len(posts) > 0 post = posts[-1] sleep(1) title = 'NEW EDIT TITLE' description = 'NEW EDIT DESCRIPTION' selenium_utils.edit_post(pytest.driver, post.id, title, description, pytest.now, pytest.now)