Beispiel #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)
Beispiel #2
0
def test__merge_ssl_params_ssl():
    ctx = ssl.SSLContext()
    assert ctx is _merge_ssl_params(ctx, None, None, None)
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #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
Beispiel #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)
def test__merge_ssl_params_verify_ssl():
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, False, None, None) is False
def test__merge_ssl_params_invlid():
    with pytest.raises(TypeError):
        _merge_ssl_params(object(), None, None, None)
Beispiel #10
0
def test__merge_ssl_params_ssl():
    ctx = ssl.SSLContext()
    assert ctx is _merge_ssl_params(ctx, None, None, None)
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #16
0
def test__merge_ssl_params_invlid():
    with pytest.raises(TypeError):
        _merge_ssl_params(object(), None, None, None)
Beispiel #17
0
def test__merge_ssl_params_verify_ssl():
    with pytest.warns(DeprecationWarning):
        assert _merge_ssl_params(None, False, None, None) is False
Beispiel #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)