# are deployed as ec2 keypairs
try:
ec2_creds = json.loads(cnxt.aws_creds).get('ec2Credentials')
- except TypeError, AttributeError:
+ except (TypeError, AttributeError):
ec2_creds = None
if ec2_creds:
import os
import unittest
+import json
import mox
from nose.plugins.attrib import attr
self.stack_identity,
'foo'))
+ def test_stack_authorize_stack_user_attribute_error(self):
+ self.m.StubOutWithMock(json, 'loads')
+ json.loads(mox.IgnoreArg()).AndRaise(AttributeError)
+ self.assertFalse(self.man._authorize_stack_user(self.ctx,
+ self.stack_identity,
+ 'foo'))
+
+ def test_stack_authorize_stack_user_type_error(self):
+ self.m.StubOutWithMock(json, 'loads')
+ json.loads(mox.IgnoreArg()).AndRaise(TypeError)
+ self.assertFalse(self.man._authorize_stack_user(self.ctx,
+ self.stack_identity,
+ 'foo'))
+
def test_stack_resources_describe(self):
resources = self.man.describe_stack_resources(self.ctx,
self.stack_identity,