Exemplo n.º 1
0
def test_creates_engine(monkeypatch):
    engine = pretend.stub()
    create_engine = pretend.call_recorder(lambda *a, **kw: engine)
    monkeypatch.setattr(sqlalchemy, "create_engine", create_engine)

    listen = pretend.call_recorder(lambda *a, **kw: None)
    monkeypatch.setattr(db.event, "listen", listen)

    url = pretend.stub()

    assert _create_engine(url) is engine
    assert create_engine.calls == [
        pretend.call(
            url,
            isolation_level=DEFAULT_ISOLATION,
            pool_size=35,
            max_overflow=65,
            pool_timeout=20,
        )
    ]
    assert listen.calls == [pretend.call(engine, "reset", _reset)]
Exemplo n.º 2
0
def test_creates_engine(monkeypatch):
    engine = pretend.stub()
    create_engine = pretend.call_recorder(lambda *a, **kw: engine)
    monkeypatch.setattr(sqlalchemy, "create_engine", create_engine)

    listen = pretend.call_recorder(lambda *a, **kw: None)
    monkeypatch.setattr(db.event, "listen", listen)

    url = pretend.stub()

    assert _create_engine(url) is engine
    assert create_engine.calls == [
        pretend.call(
            url,
            isolation_level=DEFAULT_ISOLATION,
            pool_size=35,
            max_overflow=65,
            pool_timeout=20,
        ),
    ]
    assert listen.calls == [pretend.call(engine, "reset", _reset)]