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)
def test__merge_ssl_params_ssl(): ctx = ssl.SSLContext() assert ctx is _merge_ssl_params(ctx, None, None, None)
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)
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
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)
def test__merge_ssl_params_ssl_context(): ctx = ssl.SSLContext() with pytest.warns(DeprecationWarning): assert _merge_ssl_params(None, None, ctx, None) is ctx
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)
def test__merge_ssl_params_ssl(): ctx = ssl.SSLContext() assert ctx is _merge_ssl_params(ctx, None, None, None)
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)
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
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)
def test__merge_ssl_params_ssl_context(): ctx = ssl.SSLContext() with pytest.warns(DeprecationWarning): assert _merge_ssl_params(None, None, ctx, None) is ctx
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_invlid(): with pytest.raises(TypeError): _merge_ssl_params(object(), None, 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_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)