Ejemplo n.º 1
0
def test_repository_can_add_a_director(session_factory):
    repo = SqlAlchemyRepository(session_factory)
    director = Director("Fred")

    repo.add_director(director)

    assert director in repo.get_directors()
def test_get_directors_by_name(session_factory):
    repository = SqlAlchemyRepository(session_factory)
    repository.add_director(Director("Mari Okada"))
    repository.add_director(Director("Mari Omada"))
    assert repository.get_directors_by_name("mari ok") == [
        Director("Mari Okada")
    ]
    assert repository.get_directors_by_name("xyz") == []
    assert repository.get_directors_by_name("mari o") == [
        Director("Mari Okada"), Director("Mari Omada")
    ]
    assert repository.get_directors_by_name(1) == []
def test_add_and_get_director(session_factory):
    repository = SqlAlchemyRepository(session_factory)
    repository.add_director(Director("Mari Okada"))
    assert repository.get_director(
        "Mari Okada").director_full_name == "Mari Okada"
    assert repository.get_director("Mari Omada") is None