def test_get_actors_by_name(session_factory):
    repository = SqlAlchemyRepository(session_factory)
    repository.add_actor(Actor("Ikue Ootani"))
    repository.add_actor(Actor("Ikue Arai"))
    assert repository.get_actors_by_name("ikue ootani") == [
        Actor("Ikue Ootani")
    ]
    assert repository.get_actors_by_name("xyz") == []
    assert repository.get_actors_by_name("ikue ") == [
        Actor("Ikue Arai"), Actor("Ikue Ootani")
    ]
    assert repository.get_actors_by_name(1) == []
Example #2
0
def test_repository_can_add_a_actor(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    actor = Actor("Dave Brown")
    repo.add_actor(actor)
    assert actor in repo.get_actors()
def test_add_and_get_actor(session_factory):
    repository = SqlAlchemyRepository(session_factory)
    repository.add_actor(Actor("Ikue Ootani"))
    assert repository.get_actor("Ikue Ootani") == Actor("Ikue Ootani")
    assert repository.get_actor("Satomi Arai") is None