mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
utils.boto: fix missing import and add regression test
This commit is contained in:
parent
526579c664
commit
d642b5bc89
@ -16,6 +16,7 @@ import logging
|
||||
from distutils.version import LooseVersion as _LooseVersion # pylint: disable=import-error,no-name-in-module
|
||||
|
||||
# Import salt libs
|
||||
import salt.ext.six as six
|
||||
from salt.exceptions import SaltInvocationError, CommandExecutionError
|
||||
from salt._compat import ElementTree as ET
|
||||
|
||||
@ -161,6 +162,7 @@ def get_connection(service, module=None, region=None, key=None, keyid=None,
|
||||
__context__[cxkey] = conn
|
||||
return conn
|
||||
|
||||
|
||||
def get_exception(e):
|
||||
'''
|
||||
Extract the message from a boto exception and return a
|
||||
|
@ -143,6 +143,11 @@ class BotoUtilsGetConnTestCase(BotoUtilsTestCaseBase):
|
||||
conn = salt.utils.boto.get_connection(service, **conn_parameters)
|
||||
self.assertTrue(conn in salt.utils.boto.__context__.values())
|
||||
|
||||
@mock_ec2
|
||||
def test_conn_is_cache_with_profile(self):
|
||||
conn = salt.utils.boto.get_connection(service, profile=conn_parameters)
|
||||
self.assertTrue(conn in salt.utils.boto.__context__.values())
|
||||
|
||||
@mock_ec2
|
||||
def test_get_conn_with_no_auth_params_raises_invocation_error(self):
|
||||
with patch('boto.{0}.connect_to_region'.format(service),
|
||||
@ -183,4 +188,4 @@ class BotoUtilsGetExceptionTestCase(BotoUtilsTestCaseBase):
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(BotoUtilsGetExceptionTestCase, needs_daemon=False)
|
||||
run_tests(BotoUtilsGetConnTestCase, needs_daemon=False)
|
||||
|
Loading…
Reference in New Issue
Block a user