salt/tests/integration/modules/test_boto_iam.py
Erik Johnson 4ca7931655
[PY3] Update modules/states for PY3/Unicode compatibility (B)
This includes all the boto modules
2018-01-17 17:06:07 -06:00

38 lines
1008 B
Python

# -*- coding: utf-8 -*-
'''
Validate the boto_iam module
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
# Import 3rd-party libs
try:
import boto
NO_BOTO_MODULE = False
except ImportError:
NO_BOTO_MODULE = True
@skipIf(
NO_BOTO_MODULE,
'Please install the boto library before running boto integration tests.'
)
class BotoIAMTest(ModuleCase):
def setUp(self):
try:
boto.connect_iam()
except boto.exception.NoAuthHandlerFound:
self.skipTest('Please setup boto AWS credentials before running boto integration tests.')
def test_get_account_id(self):
ret = self.run_function('boto_iam.get_account_id')
# The AWS account ID is a 12-digit number.
# http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html
self.assertRegex(ret, r'^\d{12}$')