Exemplo n.º 1
0
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
Exemplo n.º 2
0
def step_impl(context):
    reset_database()
Exemplo n.º 3
0
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
Exemplo n.º 4
0
def test_search_invalid_field(client):
    reset_database()
    soup = make_soup(client.get("/?asdasd=asd").data)
    assert soup.find(class_="card-body") is None
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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