示例#1
0
def test_azure_session_class_connection_string():
    """AzureSession works"""
    azure_session = AzureSession(
        azure_storage_connection_string=
        'AccountName=myaccount;AccountKey=MY_ACCOUNT_KEY')
    assert azure_session._creds
    assert (azure_session.get_credential_options()
            ['AZURE_STORAGE_CONNECTION_STRING'] ==
            'AccountName=myaccount;AccountKey=MY_ACCOUNT_KEY')
示例#2
0
def test_azure_session_class():
    """AzureSession works"""
    azure_session = AzureSession(azure_storage_account='foo',
                                 azure_storage_access_key='bar')
    assert azure_session._creds
    assert azure_session.get_credential_options(
    )['AZURE_STORAGE_ACCOUNT'] == 'foo'
    assert azure_session.get_credential_options(
    )['AZURE_STORAGE_ACCESS_KEY'] == 'bar'
示例#3
0
def test_azure_session_credentials_connection_string(gdalenv):
    """Create an Env with azure session."""
    azure_session = AzureSession(
        azure_storage_connection_string='AccountName=myaccount;AccountKey=MY_ACCOUNT_KEY',
    )
    with rasterio.env.Env(session=azure_session) as s:
        s.credentialize()
        assert getenv()['AZURE_STORAGE_CONNECTION_STRING'] == 'AccountName=myaccount;AccountKey=MY_ACCOUNT_KEY'
示例#4
0
def test_azure_session_credentials(gdalenv):
    """Create an Env with azure session."""
    azure_session = AzureSession(azure_storage_account='foo',
                                 azure_storage_access_key='bar')
    with rasterio.env.Env(session=azure_session) as s:
        s.credentialize()
        assert getenv()['AZURE_STORAGE_ACCOUNT'] == 'foo'
        assert getenv()['AZURE_STORAGE_ACCESS_KEY'] == 'bar'
示例#5
0
def test_azure_session_class_unsigned():
    """AzureSession works"""
    sesh = AzureSession(azure_unsigned=True, azure_storage_account='naipblobs')
    assert sesh.get_credential_options()['AZURE_NO_SIGN_REQUEST'] == 'YES'
    assert sesh.get_credential_options(
    )['AZURE_STORAGE_ACCOUNT'] == 'naipblobs'
示例#6
0
def test_azure_no_sign_request(monkeypatch):
    """If AZURE_NO_SIGN_REQUEST is set do not default to azure_unsigned=False"""
    monkeypatch.setenv('AZURE_NO_SIGN_REQUEST', 'YES')
    assert AzureSession().unsigned