def _(browser=browser): content = ContentFactory.create(name="Introdução ao Flask") browser.visit(url_for("contents.show", content_slug=content.slug)) assert browser.is_text_present(content.author.name) assert browser.is_text_present(content.author.description)
def _(browser=browser): content = ContentFactory.create(name="Introdução ao Flask") browser.visit(url_for("contents.show", content_slug=content.slug)) timestamp = format_datetime(content.updated_on, "medium") assert browser.is_text_present( f"O conteúdo apresentado foi atualizado em {timestamp} e poderá ser modificado a qualquer momento sem aviso prévio." )
def _(browser=browser): content = ContentFactory.create(name="Introdução ao Flask") browser.visit(url_for("home.index")) browser.find_by_text(content.name).first.click() assert browser.url == f"/conteudo/{content.slug}" assert browser.status_code.is_success() assert browser.is_text_present(content.name)
def _(browser=browser): s = Source(name="Apostila de flask", link="https://negros.dev/apostila-flask.pdf") s2 = Source(name="Apostila de flask", link="https://negros.dev/apostila-flask.pdf") content = ContentFactory.create(name="Introdução ao Flask", sources=[s, s2]) browser.visit(url_for("contents.show", content_slug=content.slug)) assert browser.is_text_present(s.name) assert browser.is_text_present(s2.name)
def _(browser=browser): contents = ContentFactory.create_batch(10) content_found = contents[5] browser.visit(url_for("home.index")) browser.find_by_name("content_name").fill(content_found.name) browser.find_by_value("BUSCAR").click() assert browser.is_text_present(content_found.name)
def _(browser=browser): content1 = ContentFactory.create( created_on=datetime.strptime("08/10/21 08:00", "%d/%m/%y %H:%M")) content2 = ContentFactory.create( created_on=datetime.strptime("10/10/21 21:23", "%d/%m/%y %H:%M")) content3 = ContentFactory.create( created_on=datetime.strptime("11/10/21 10:35", "%d/%m/%y %H:%M")) content4 = ContentFactory.create( created_on=datetime.strptime("08/10/21 11:11", "%d/%m/%y %H:%M")) browser.visit(url_for("home.index")) assert content1.name in str( browser.find_by_css("#contents > ol > li:nth-child(1)").first.text) assert content4.name in str( browser.find_by_css("#contents > ol > li:nth-child(2)").first.text) assert content2.name in str( browser.find_by_css("#contents > ol > li:nth-child(3)").first.text) assert content3.name in str( browser.find_by_css("#contents > ol > li:nth-child(4)").first.text)
def _(browser=browser): content = ContentFactory.create(name="Testando aplicações flask") browser.visit(url_for("home.index")) assert browser.is_text_present(content.name)