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

    actor = Actor("Keanu Reeves")
    repo.add_actor(actor)

    assert repo.get_actor("Keanu Reeves") == actor and repo.get_actor("Keanu Reeves") is actor
def test_repository_returns_none_for_non_existent_actor(session_factory):
    repo = SqlAlchemyRepository(session_factory)
    actor = repo.get_actor('Fake Actor')
    assert actor is None
def test_repository_can_retrieve_an_actor(session_factory):
    repo = SqlAlchemyRepository(session_factory)
    actor = repo.get_actor("Chris Pratt")
    assert actor == Actor("Chris Pratt")
    assert Movie("Guardians of the Galaxy", 2014) in actor.played_movies