Esempio n. 1
0
def parse_key_configurator(config):
    """Return a properly configured KeyConfigurator from 'config'."""
    matcher, config = extract_matcher(config)
    try:
        return KeyConfigurator(matcher=matcher, **config)
    except TypeError as e:
        raise convert_type_error(e)
Esempio n. 2
0
def test_key_configurator_configure_key():
    c = KeyConfigurator()
    c.reduced_redundancy = True
    c.encrypted = False
    c.cache_control = 'test'
    c.canned_acl = 'public-read'
    c.metadata = {'some':'metadata'}

    # Create new key and run configurator on it
    k = Key(None, 'bucket', 'key', canned_acl='private', encrypted=True,
            metadata={'some':'otherdata'}, cache_control='original')
    k = c.configure_key(k)

    # Confirm configurator worked as expected
    assert k.reduced_redundancy
    assert not k.encrypted
    assert k.cache_control == 'test'
    assert k.canned_acl == 'public-read'
    assert k.metadata['some'] == 'metadata'
Esempio n. 3
0
def test_key_configurator_configure_key():
    c = KeyConfigurator()
    c.reduced_redundancy = True
    c.encrypted = False
    c.cache_control = 'test'
    c.canned_acl = 'public-read'
    c.metadata = {'some': 'metadata'}

    # Create new key and run configurator on it
    k = Key(None,
            'bucket',
            'key',
            canned_acl='private',
            encrypted=True,
            metadata={'some': 'otherdata'},
            cache_control='original')
    k = c.configure_key(k)

    # Confirm configurator worked as expected
    assert k.reduced_redundancy
    assert not k.encrypted
    assert k.cache_control == 'test'
    assert k.canned_acl == 'public-read'
    assert k.metadata['some'] == 'metadata'
Esempio n. 4
0
def test_key_configurator_effects_key():
    c = KeyConfigurator(matcher=Matcher(['*.py']))
    assert c.effects_key('test.py')
    assert not c.effects_key('test.md')
Esempio n. 5
0
def test_key_configurator_effects_key():
    c = KeyConfigurator(matcher=Matcher(['*.py']))
    assert c.effects_key('test.py')
    assert not c.effects_key('test.md')