summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcameron-r <crowshanbin@gmail.com>2014-11-05 15:26:48 -0600
committercameron-r <crowshanbin@gmail.com>2014-11-05 15:27:45 -0600
commit693c165a73d8073c594f5b06162966c0678de2f2 (patch)
tree0f77b16e193f2cc9d3458c4fc91fe2ec89d0f011
parent9826b0778ccfa1dce9906e16d217207b27f2d0b8 (diff)
Cameron & Ed | Fix EC2RuleTransformer constructor use, updated security group rule integration test
-rw-r--r--ec2driver.py2
-rw-r--r--tests/integration/test_security_groups.py16
2 files changed, 9 insertions, 9 deletions
diff --git a/ec2driver.py b/ec2driver.py
index f0c9c44..822424b 100644
--- a/ec2driver.py
+++ b/ec2driver.py
@@ -173,7 +173,7 @@ class EC2Driver(driver.ComputeDriver):
173 ), 173 ),
174 ec2_rule_service=EC2RuleService( 174 ec2_rule_service=EC2RuleService(
175 ec2_connection=self.ec2_conn, 175 ec2_connection=self.ec2_conn,
176 ec2_rule_transformer=EC2RuleTransformer() 176 ec2_rule_transformer=EC2RuleTransformer(self.ec2_conn)
177 ) 177 )
178 ) 178 )
179 ) 179 )
diff --git a/tests/integration/test_security_groups.py b/tests/integration/test_security_groups.py
index f916750..3f3dd29 100644
--- a/tests/integration/test_security_groups.py
+++ b/tests/integration/test_security_groups.py
@@ -3,7 +3,7 @@ import unittest
3from random import randint 3from random import randint
4 4
5from ...ec2driver_config import * 5from ...ec2driver_config import *
6from tests.integration.ec2_test_base import EC2TestBase 6from ec2_test_base import EC2TestBase
7 7
8 8
9class TestSecurityGroups(EC2TestBase): 9class TestSecurityGroups(EC2TestBase):
@@ -36,9 +36,9 @@ class TestSecurityGroups(EC2TestBase):
36 36
37 updated_matching_ec2_security_group = self._wait_for_ec2_group_to_have_no_instances(self.security_group) 37 updated_matching_ec2_security_group = self._wait_for_ec2_group_to_have_no_instances(self.security_group)
38 self.assertEqual(updated_matching_ec2_security_group.instances(), []) 38 self.assertEqual(updated_matching_ec2_security_group.instances(), [])
39 39
40 def test_should_add_rule_to_ec2_security_group_when_group_is_added_to_an_instance(self): 40 @unittest.skipIf(os.environ.get('MOCK_EC2'), 'Not supported by moto')
41 41 def test_should_add_rule_to_ec2_security_group_when_rule_is_added_to_openstack_group_associated_with_instance(self):
42 security_group_rule = self.nova.security_group_rules.create( 42 security_group_rule = self.nova.security_group_rules.create(
43 parent_group_id=self.security_group.id, 43 parent_group_id=self.security_group.id,
44 ip_protocol='tcp', 44 ip_protocol='tcp',
@@ -47,13 +47,13 @@ class TestSecurityGroups(EC2TestBase):
47 cidr='0.0.0.0/0' 47 cidr='0.0.0.0/0'
48 ) 48 )
49 49
50 updated_security_group = self.nova.security_groups.get(self.security_group.id)
51
52 ec2_security_group = self.ec2_conn.get_all_security_groups(groupnames=self.security_group.name)[0] 50 ec2_security_group = self.ec2_conn.get_all_security_groups(groupnames=self.security_group.name)[0]
53 ec2_rule = ec2_security_group.rules[0] 51 ec2_rule = ec2_security_group.rules[0]
54 52
55 self.assertEqual(ec2_rule.ip_protocol, security_group_rule.ip_protocol) 53 self.assertEqual(ec2_rule.ip_protocol, security_group_rule['ip_protocol'])
56 #etc 54 self.assertEqual(ec2_rule.from_port, security_group_rule['from_port'])
55 self.assertEqual(ec2_rule.to_port, security_group_rule['to_port'])
56 self.assertEqual(ec2_rule.grants[0].cidr_ip, security_group_rule['ip_range']['cidr'])
57 57
58 def _destroy_security_group(self): 58 def _destroy_security_group(self):
59 print "Cleanup: Destroying security group" 59 print "Cleanup: Destroying security group"