def test_driver_validate_credentials():
    driver = GoogleStorageDriver(key=GOOGLE_CREDENTIALS)
    assert driver.validate_credentials() is None

    driver = GoogleStorageDriver(key=GOOGLE_CREDENTIALS)
    with pytest.raises(CredentialsError) as excinfo:
        driver.validate_credentials()
    assert excinfo.value
    assert excinfo.value.message
Beispiel #2
0
def storage():
    driver = GoogleStorageDriver(key=GOOGLE_CREDENTIALS)

    yield driver

    for container in driver:  # cleanup
        if container.name.startswith(CONTAINER_PREFIX):
            for blob in container:
                blob.delete()

            container.delete()
def storage():
    driver = GoogleStorageDriver(key=GOOGLE_CREDENTIALS)

    yield driver

    seconds = random.random() * 3
    for container in driver:  # cleanup
        if container.name.startswith(CONTAINER_PREFIX):
            for blob in container:
                sleep(seconds)
                blob.delete()

            sleep(seconds)
            container.delete()
Beispiel #4
0
def container():
    storage = GoogleStorageDriver()
    return storage.get_container(config.STORAGE_CONTAINER)
Beispiel #5
0
from cloudstorage import get_driver_by_name
from cloudstorage.drivers.google import GoogleStorageDriver
from . import config


def container():
    storage = GoogleStorageDriver()
    return storage.get_container(config.STORAGE_CONTAINER)


storage = GoogleStorageDriver()
documents = storage.get_container(config.STORAGE_CONTAINER)
signatures = storage.get_container(config.STORAGE_CONTAINER)