salt/tests/integration/modules/test_boto_iam.py

38 lines
1008 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
'''
Validate the boto_iam module
'''
2015-01-21 02:13:19 +00:00
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
2015-01-21 02:13:19 +00:00
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
2015-01-21 02:13:19 +00:00
# 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')
2015-01-14 19:12:23 +00:00
# The AWS account ID is a 12-digit number.
# http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html
2017-03-31 11:22:33 +00:00
self.assertRegex(ret, r'^\d{12}$')