示例#1
0
def test_client_config_converts(kwargs, stream_type):
    kwargs[
        "commitment_policy"] = CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT
    test = _ClientConfig(**kwargs)
    assert isinstance(test.source, stream_type)
    if test.key_provider is not None:
        assert isinstance(test.materials_manager,
                          DefaultCryptoMaterialsManager)
示例#2
0
def test_client_config_converts(kwargs, stream_type):
    test = _ClientConfig(**kwargs)
    assert isinstance(test.source, stream_type)
    if test.key_provider is not None:
        assert isinstance(test.materials_manager,
                          DefaultCryptoMaterialsManager)
示例#3
0
def test_client_config_defaults():
    test = _ClientConfig(**BASE_KWARGS)
    assert test.source_length is None
    assert test.line_length == LINE_LENGTH
def test_client_config_defaults():
    test = _ClientConfig(**BASE_KWARGS)
    assert test.source_length is None
    assert test.line_length == LINE_LENGTH
    assert test.max_encrypted_data_keys is None
示例#5
0
def test_attributes_converts():
    test = _ClientConfig(source='',
                         key_provider=MagicMock(__class__=MasterKeyProvider))
    assert isinstance(test.source, io.BytesIO)
    assert isinstance(test.materials_manager, DefaultCryptoMaterialsManager)
    assert test.materials_manager.master_key_provider is test.key_provider
示例#6
0
def test_attributes_defaults():
    test = _ClientConfig(source='',
                         key_provider=MagicMock(__class__=MasterKeyProvider))
    assert test.source_length is None
    assert test.line_length == LINE_LENGTH
示例#7
0
def test_attributes_fail(key_provider, materials_manager, source_length):
    with pytest.raises(TypeError):
        _ClientConfig(source='',
                      key_provider=key_provider,
                      materials_manager=materials_manager,
                      source_length=source_length)