Beispiel #1
0
def test_repository_can_retrieve_articles_by_date(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    articles = repo.get_articles_by_date(date(2020, 3, 1))

    # Check that the query returned 3 Articles.
    assert len(articles) == 3

    # these articles are no jokes...
    articles = repo.get_articles_by_date(date(2020, 4, 1))

    # Check that the query returned 5 Articles.
    assert len(articles) == 5
def test_repository_can_retrieve_articles_by_date(session):
    repo = SqlAlchemyRepository(session)

    articles = repo.get_articles_by_date(date(2020, 3, 1))

    # Check that the query returned 3 Articles.
    assert len(articles) == 3
Beispiel #3
0
def test_repository_does_not_retrieve_an_article_when_there_are_no_articles_for_a_given_date(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    articles = repo.get_articles_by_date(date(2020, 3, 8))
    assert len(articles) == 0