summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lindsley <daniel@toastdriven.com>2013-09-13 15:08:53 -0700
committerDaniel Lindsley <daniel@toastdriven.com>2013-09-13 15:08:53 -0700
commit0a52c82114fb6777b22fc078a6e3232d37c3d5c7 (patch)
treee073e48c7a16a2aae038cfc4a327f00ca6fd13d6
parent2685711c3fc2ee682f3d7f588821a54fb3046ce1 (diff)
downloadboto-0a52c82114fb6777b22fc078a6e3232d37c3d5c7.tar.gz
Fixes #1722 - Missed a place where ``dry_run`` is supposed to be supplied.
-rw-r--r--boto/ec2/securitygroup.py3
-rw-r--r--tests/unit/ec2/test_securitygroup.py22
2 files changed, 24 insertions, 1 deletions
diff --git a/boto/ec2/securitygroup.py b/boto/ec2/securitygroup.py
index 3d93faa2..f1e81cd9 100644
--- a/boto/ec2/securitygroup.py
+++ b/boto/ec2/securitygroup.py
@@ -348,7 +348,8 @@ class IPPermissions(object):
else:
setattr(self, name, value)
- def add_grant(self, name=None, owner_id=None, cidr_ip=None, group_id=None):
+ def add_grant(self, name=None, owner_id=None, cidr_ip=None, group_id=None,
+ dry_run=False):
grant = GroupOrCIDR(self)
grant.owner_id = owner_id
grant.group_id = group_id
diff --git a/tests/unit/ec2/test_securitygroup.py b/tests/unit/ec2/test_securitygroup.py
index 2876ffff..c2cd5bca 100644
--- a/tests/unit/ec2/test_securitygroup.py
+++ b/tests/unit/ec2/test_securitygroup.py
@@ -6,6 +6,8 @@ from tests.unit import AWSMockServiceTestCase
import mock
from boto.ec2.connection import EC2Connection
+from boto.ec2.securitygroup import SecurityGroup
+
DESCRIBE_SECURITY_GROUP = r"""<?xml version="1.0" encoding="UTF-8"?>
<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2013-06-15/">
@@ -182,3 +184,23 @@ class TestDescribeSecurityGroups(AWSMockServiceTestCase):
self.assertEqual(1, len(instances))
self.assertEqual(groups[0].id, instances[0].groups[0].id)
+
+
+class SecurityGroupTest(unittest.TestCase):
+ def test_add_rule(self):
+ sg = SecurityGroup()
+ self.assertEqual(len(sg.rules), 0)
+
+ # Regression: ``dry_run`` was being passed (but unhandled) before.
+ sg.add_rule(
+ ip_protocol='http',
+ from_port='80',
+ to_port='8080',
+ src_group_name='groupy',
+ src_group_owner_id='12345',
+ cidr_ip='10.0.0.1',
+ src_group_group_id='54321',
+ dry_run=False
+ )
+ self.assertEqual(len(sg.rules), 1)
+