Ejemplo n.º 1
0
def test_verify_ssl_false_with_ssl_context(loop, ssl_ctx) -> None:
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(None,
                              verify_ssl=False,
                              ssl_context=ssl_ctx,
                              fingerprint=None)
Ejemplo n.º 2
0
def test__merge_ssl_params_ssl():
    ctx = ssl.SSLContext()
    assert ctx is _merge_ssl_params(ctx, None, None, None)
Ejemplo n.º 3
0
def test__merge_ssl_params_fingerprint_conflict():
    fingerprint = aiohttp.Fingerprint(hashlib.sha256(b'123').digest())
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx, None, None, fingerprint)
Ejemplo n.º 4
0
def test__merge_ssl_params_fingerprint():
    digest = hashlib.sha256(b'123').digest()
    with pytest.warns(DeprecationWarning):
        ret = _merge_ssl_params(None, None, None, digest)
        assert ret.fingerprint == digest
Ejemplo n.º 5
0
def test__merge_ssl_params_ssl_context_conflict():
    ctx1 = ssl.SSLContext()
    ctx2 = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx1, None, ctx2, None)
Ejemplo n.º 6
0
def test__merge_ssl_params_ssl_context():
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, None, ctx, None) is ctx
Ejemplo n.º 7
0
def test__merge_ssl_params_verify_ssl_conflict():
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx, False, None, None)
Ejemplo n.º 8
0
def test__merge_ssl_params_verify_ssl():
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, False, None, None) is False
Ejemplo n.º 9
0
def test__merge_ssl_params_invlid():
    with pytest.raises(TypeError):
        _merge_ssl_params(object(), None, None, None)
Ejemplo n.º 10
0
def test__merge_ssl_params_ssl():
    ctx = ssl.SSLContext()
    assert ctx is _merge_ssl_params(ctx, None, None, None)
Ejemplo n.º 11
0
def test__merge_ssl_params_fingerprint_conflict():
    fingerprint = aiohttp.Fingerprint(hashlib.sha256(b'123').digest())
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx, None, None, fingerprint)
Ejemplo n.º 12
0
def test__merge_ssl_params_fingerprint():
    digest = hashlib.sha256(b'123').digest()
    with pytest.warns(DeprecationWarning):
        ret = _merge_ssl_params(None, None, None, digest)
        assert ret.fingerprint == digest
Ejemplo n.º 13
0
def test__merge_ssl_params_ssl_context_conflict():
    ctx1 = ssl.SSLContext()
    ctx2 = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx1, None, ctx2, None)
Ejemplo n.º 14
0
def test__merge_ssl_params_ssl_context():
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, None, ctx, None) is ctx
Ejemplo n.º 15
0
def test__merge_ssl_params_verify_ssl_conflict():
    ctx = ssl.SSLContext()
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(ctx, False, None, None)
Ejemplo n.º 16
0
def test__merge_ssl_params_invlid():
    with pytest.raises(TypeError):
        _merge_ssl_params(object(), None, None, None)
Ejemplo n.º 17
0
def test__merge_ssl_params_verify_ssl():
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, False, None, None) is False
Ejemplo n.º 18
0
def test_verify_ssl_false_with_ssl_context(loop):
    with pytest.warns(DeprecationWarning):
        with pytest.raises(ValueError):
            _merge_ssl_params(None, verify_ssl=False,
                              ssl_context=mock.Mock(), fingerprint=None)