mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
ef02779391
commit
b4fe9aaa11
2 changed files with 14 additions and 1 deletions
|
@ -256,7 +256,7 @@ def _get_key(key, keyid, service_url, verify_ssl, location, role_arn):
|
|||
if location is None and __salt__['config.option']('s3.location') is not None:
|
||||
location = __salt__['config.option']('s3.location')
|
||||
|
||||
if role_arn is None and __salt__['config.option']('s3.role_arn') is not None:
|
||||
if role_arn is None and __salt__['config.option']('s3.role_arn'):
|
||||
role_arn = __salt__['config.option']('s3.role_arn')
|
||||
|
||||
return key, keyid, service_url, verify_ssl, location, role_arn
|
||||
|
|
|
@ -8,6 +8,7 @@ from __future__ import absolute_import
|
|||
# Import Salt Testing Libs
|
||||
from salttesting import skipIf, TestCase
|
||||
from salttesting.mock import (
|
||||
MagicMock,
|
||||
NO_MOCK,
|
||||
NO_MOCK_REASON,
|
||||
patch
|
||||
|
@ -21,9 +22,21 @@ ensure_in_syspath('../../')
|
|||
import salt.utils.s3
|
||||
from salt.modules import s3
|
||||
|
||||
s3.__salt__ = {}
|
||||
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
class S3TestCase(TestCase):
|
||||
def test__get_key_defaults(self):
|
||||
mock = MagicMock(return_value='')
|
||||
with patch.dict(s3.__salt__, {'config.option': mock}):
|
||||
key, keyid, service_url, verify_ssl, location, role_arn = (
|
||||
s3._get_key(None, None, None, None, None, None))
|
||||
self.assertEqual(None, role_arn)
|
||||
self.assertEqual(None, key)
|
||||
self.assertEqual(None, keyid)
|
||||
self.assertEqual('s3.amazonaws.com', service_url)
|
||||
self.assertEqual('', verify_ssl)
|
||||
self.assertEqual('', location)
|
||||
'''
|
||||
Test cases for salt.modules.s3
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue