From c0d19ab178b83179d70ed1d25fc2864aef153db7 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sat, 14 Mar 2015 18:55:44 -0400 Subject: [PATCH] General cleanup. --- moto/ec2/models.py | 3 +-- .../test_cloudformation_stack_integration.py | 4 ++-- tests/test_ec2/test_vpcs.py | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 940c412e7..9d73e1164 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -1308,7 +1308,7 @@ class SecurityGroupIngress(object): from_port = properties.get("FromPort") source_security_group_id = properties.get("SourceSecurityGroupId") source_security_group_name = properties.get("SourceSecurityGroupName") - source_security_owner_id = properties.get("SourceSecurityGroupOwnerId") # IGNORED AT THE MOMENT + # source_security_owner_id = properties.get("SourceSecurityGroupOwnerId") # IGNORED AT THE MOMENT to_port = properties.get("ToPort") assert group_id or group_name @@ -1328,7 +1328,6 @@ class SecurityGroupIngress(object): else: ip_ranges = [] - if group_id: security_group = ec2_backend.describe_security_groups(group_ids=[group_id])[0] else: diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py index e73197361..170a5226c 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_integration.py +++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py @@ -339,7 +339,7 @@ def test_vpc_single_instance_in_subnet(): eip.domain.should.equal('vpc') eip.instance_id.should.equal(instance.id) - security_group = ec2_conn.get_all_security_groups()[0] + security_group = ec2_conn.get_all_security_groups(filters={'vpc_id': [vpc.id]})[0] security_group.vpc_id.should.equal(vpc.id) stack = conn.describe_stacks()[0] @@ -1014,7 +1014,7 @@ def test_vpc_peering_creation(): @mock_cloudformation @mock_ec2 -def test_security_group_ingress_separate_from_security_group_by_id(): +def test_multiple_security_group_ingress_separate_from_security_group_by_id(): template = { "AWSTemplateFormatVersion": "2010-09-09", "Resources": { diff --git a/tests/test_ec2/test_vpcs.py b/tests/test_ec2/test_vpcs.py index 21ebce826..e4148625c 100644 --- a/tests/test_ec2/test_vpcs.py +++ b/tests/test_ec2/test_vpcs.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals # Ensure 'assert_raises' context manager support for Python 2.6 -import tests.backport_assert_raises +import tests.backport_assert_raises # flake8: noqa from nose.tools import assert_raises import boto @@ -72,7 +72,7 @@ def test_vpc_get_by_id(): conn = boto.connect_vpc() vpc1 = conn.create_vpc("10.0.0.0/16") vpc2 = conn.create_vpc("10.0.0.0/16") - vpc3 = conn.create_vpc("10.0.0.0/16") + conn.create_vpc("10.0.0.0/16") vpcs = conn.get_all_vpcs(vpc_ids=[vpc1.id, vpc2.id]) vpcs.should.have.length_of(2) @@ -86,7 +86,7 @@ def test_vpc_get_by_cidr_block(): conn = boto.connect_vpc() vpc1 = conn.create_vpc("10.0.0.0/16") vpc2 = conn.create_vpc("10.0.0.0/16") - vpc3 = conn.create_vpc("10.0.0.0/24") + conn.create_vpc("10.0.0.0/24") vpcs = conn.get_all_vpcs(filters={'cidr': '10.0.0.0/16'}) vpcs.should.have.length_of(2) @@ -101,7 +101,7 @@ def test_vpc_get_by_dhcp_options_id(): dhcp_options = conn.create_dhcp_options(SAMPLE_DOMAIN_NAME, SAMPLE_NAME_SERVERS) vpc1 = conn.create_vpc("10.0.0.0/16") vpc2 = conn.create_vpc("10.0.0.0/16") - vpc3 = conn.create_vpc("10.0.0.0/24") + conn.create_vpc("10.0.0.0/24") conn.associate_dhcp_options(dhcp_options.id, vpc1.id) conn.associate_dhcp_options(dhcp_options.id, vpc2.id) @@ -196,7 +196,7 @@ def test_vpc_get_by_tag_value_subset(): conn = boto.connect_vpc() vpc1 = conn.create_vpc("10.0.0.0/16") vpc2 = conn.create_vpc("10.0.0.0/16") - vpc3 = conn.create_vpc("10.0.0.0/24") + conn.create_vpc("10.0.0.0/24") vpc1.add_tag('Name', 'TestVPC') vpc1.add_tag('Key', 'TestVPC2')