2015-01-14 19:08:54 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
Validate the boto_iam module
|
|
|
|
'''
|
2015-01-21 02:13:19 +00:00
|
|
|
|
|
|
|
# Import Python libs
|
2018-01-17 23:05:08 +00:00
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
2015-01-21 02:13:19 +00:00
|
|
|
|
|
|
|
# Import Salt Testing libs
|
2017-04-03 16:04:09 +00:00
|
|
|
from tests.support.case import ModuleCase
|
2017-02-27 13:58:07 +00:00
|
|
|
from tests.support.unit import skipIf
|
2015-01-14 19:08:54 +00:00
|
|
|
|
2015-01-21 02:13:19 +00:00
|
|
|
# Import 3rd-party libs
|
2015-01-14 19:49:54 +00:00
|
|
|
try:
|
|
|
|
import boto
|
|
|
|
NO_BOTO_MODULE = False
|
|
|
|
except ImportError:
|
2017-04-12 11:34:14 +00:00
|
|
|
NO_BOTO_MODULE = True
|
2015-01-14 19:49:54 +00:00
|
|
|
|
2015-01-14 19:08:54 +00:00
|
|
|
|
2015-01-14 19:49:54 +00:00
|
|
|
@skipIf(
|
|
|
|
NO_BOTO_MODULE,
|
|
|
|
'Please install the boto library before running boto integration tests.'
|
|
|
|
)
|
2017-04-03 16:04:09 +00:00
|
|
|
class BotoIAMTest(ModuleCase):
|
2015-01-14 19:08:54 +00:00
|
|
|
|
2017-04-12 11:34:14 +00:00
|
|
|
def setUp(self):
|
|
|
|
try:
|
|
|
|
boto.connect_iam()
|
|
|
|
except boto.exception.NoAuthHandlerFound:
|
|
|
|
self.skipTest('Please setup boto AWS credentials before running boto integration tests.')
|
|
|
|
|
2015-01-14 19:08:54 +00:00
|
|
|
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}$')
|