def test_search_single_field(client): reset_database() soup = make_soup(client.get("/?title=sort").data) card = soup.find(class_="card-body") assert card is not None assert "Merge sort algorithm" in card.text assert soup.find(string=re.compile("Poista rajaukset")) is not None
def step_impl(context): reset_database()
def test_search_multiple_fields(client): reset_database() soup = make_soup(client.get( "/?related_courses=tuotanto&author=martin").data) assert len(soup.find_all(class_="card-body")) == 1 assert "Clean Code: A Handbook of Agile Software Craftsmanship" in soup.text
def test_search_invalid_field(client): reset_database() soup = make_soup(client.get("/?asdasd=asd").data) assert soup.find(class_="card-body") is None
def test_empty_search(client): reset_database() soup = make_soup(client.get("/").data) assert len(soup.find_all(class_="card-body")) == 4 assert soup.find(string=re.compile("Poista rajaukset")) is None
def test_initial_data(client): reset_database() soup = make_soup(client.get("/").data) assert "Clean Code: A Handbook of Agile Software Craftsmanship" in soup.text