def test_repository_can_retrieve_article_count(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    number_of_articles = repo.get_number_of_articles()

    # Check that the query returned 177 Articles.
    assert number_of_articles == 177
def test_repository_can_add_article(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    number_of_articles = repo.get_number_of_articles()

    new_article_id = number_of_articles + 1

    article = Article(
        2014,
        'James Gunn',
        ['Chris Pratt', 'Vin Diesel', 'Bradley Cooper', 'Zoe Saldana'],
        121,
        8.1,
        'Guardians of the Galaxy',
        'A group of intergalactic criminals are forced to work together to stop a fanatical warrior from taking control of the universe.',
    )
    repo.add_article(article)

    assert repo.get_article(new_article_id) == article