Skip to content

Commit

Permalink
Rename env var for AWS_SHARED_CREDENTIALS_FILE
Browse files Browse the repository at this point in the history
Note that this is just changing a config value.
Also added an integration test for this.
  • Loading branch information
jamesls committed Aug 11, 2015
1 parent 37be1da commit 23e4220
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion botocore/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class Session(object):
# These variables are intended for internal use so don't have any
# user settable values.
# This is the shared credentials file amongst sdks.
'credentials_file': (None, 'AWS_CREDENTIALS_FILE', '~/.aws/credentials', None),
'credentials_file': (None, 'AWS_SHARED_CREDENTIALS_FILE',
'~/.aws/credentials', None),

# These variables only exist in the config file.

Expand Down
15 changes: 14 additions & 1 deletion tests/integration/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import mock

from botocore.session import Session
from tests import BaseEnvVar
from tests import BaseEnvVar, temporary_file


class TestCredentialPrecedence(BaseEnvVar):
Expand Down Expand Up @@ -107,3 +107,16 @@ def test_access_secret_env_vs_profile_code(self):

self.assertEqual(credentials.access_key, 'test')
self.assertEqual(credentials.secret_key, 'test-secret')

def test_honors_aws_shared_credentials_file_env_var(self):
with temporary_file('w') as f:
f.write('[default]\n'
'aws_access_key_id=custom1\n'
'aws_secret_access_key=custom2\n')
f.flush()
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = f.name
s = Session()
credentials = s.get_credentials()

self.assertEqual(credentials.access_key, 'custom1')
self.assertEqual(credentials.secret_key, 'custom2')

0 comments on commit 23e4220

Please sign in to comment.