def test_bogus_redis(monkeypatch):
    monkeypatch.setenv('ENV', 'testing_optional_components_redis_bogus')

    with pytest.raises(
        ConnectionError,
        match=r".*Error 111 connecting to mongo:6379. Connection refused.*",
    ):
        with TestClient(main.start_api()):
            pass
def test_nonexist_redis_required(monkeypatch):
    monkeypatch.setenv('ENV', 'testing_optional_components_redis_nonexisting_required')

    with pytest.raises(Exception, match=r".*Connect pre-check failed for.*"):
        with TestClient(main.start_api()):
            pass
def test_nonexist_redis_auto(monkeypatch):
    monkeypatch.setenv('ENV', 'testing_optional_components_redis_nonexisting_auto')

    with TestClient(main.start_api()):
        pass
def test_bogus_mongo(monkeypatch):
    monkeypatch.setenv('ENV', 'testing_optional_components_mongo_bogus')

    with pytest.raises(OperationFailure, match=r".*Authentication failed.*"):
        with TestClient(main.start_api()):
            pass
Esempio n. 5
0
def app_examples(monkeypatch):
    monkeypatch.setenv('ENV', 'testing_examples')
    with TestClient(main.start_api()) as client:
        yield client
Esempio n. 6
0
def app_dev(monkeypatch):
    monkeypatch.setenv('ENV', 'dev')
    with TestClient(main.start_api()) as client:
        yield client
Esempio n. 7
0
def app():
    with TestClient(main.start_api()) as client:
        yield client