summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcameron-r <crowshanbin@gmail.com>2014-11-06 10:27:53 -0600
committercameron-r <crowshanbin@gmail.com>2014-11-06 10:36:42 -0600
commit36649ae1fc60832eff8d7077be5722385297d4a5 (patch)
tree0e73ea89f795bd353b2ec5c697420acd2c382ebd
parentfc3e9907e75299e3fb55b93aa32503cf159133b3 (diff)
Cameron & Ed | Delete more unused rule EC2 rule args in EC2RuleTransformer, fix TestOpenstackRuleTransformer class name
-rw-r--r--ec2_rule_transformer.py5
-rw-r--r--tests/unit/fake_ec2_rule_builder.py8
-rw-r--r--tests/unit/test_openstack_rule_transformer.py2
3 files changed, 11 insertions, 4 deletions
diff --git a/ec2_rule_transformer.py b/ec2_rule_transformer.py
index a2e57ea..a83c63c 100644
--- a/ec2_rule_transformer.py
+++ b/ec2_rule_transformer.py
@@ -21,4 +21,7 @@ class EC2RuleTransformer:
21 21
22 def _delete_unused_rule_args(self, rule_args): 22 def _delete_unused_rule_args(self, rule_args):
23 del rule_args['grants'] 23 del rule_args['grants']
24 del rule_args['parent'] \ No newline at end of file 24 del rule_args['parent']
25 del rule_args['item']
26 del rule_args['ipRanges']
27 del rule_args['groups'] \ No newline at end of file
diff --git a/tests/unit/fake_ec2_rule_builder.py b/tests/unit/fake_ec2_rule_builder.py
index bf6ccb1..c0a0fdd 100644
--- a/tests/unit/fake_ec2_rule_builder.py
+++ b/tests/unit/fake_ec2_rule_builder.py
@@ -2,7 +2,7 @@ from collections import namedtuple
2 2
3class FakeEC2RuleBuilder(): 3class FakeEC2RuleBuilder():
4 4
5 EC2Rule = namedtuple('EC2Rule', 'ip_protocol from_port to_port grants parent') 5 EC2Rule = namedtuple('EC2Rule', 'ip_protocol from_port to_port grants parent item ipRanges groups')
6 GroupOrCIDR = namedtuple('GroupOrCIDR', 'cidr_ip group_id') 6 GroupOrCIDR = namedtuple('GroupOrCIDR', 'cidr_ip group_id')
7 7
8 def __init__(self): 8 def __init__(self):
@@ -12,6 +12,9 @@ class FakeEC2RuleBuilder():
12 self.ip_range = '0.0.0.0/0' 12 self.ip_range = '0.0.0.0/0'
13 self.allowed_security_group_id = None 13 self.allowed_security_group_id = None
14 self.parent = None 14 self.parent = None
15 self.item = '\n'
16 self.ip_ranges = '\n'
17 self.groups = ''
15 18
16 @staticmethod 19 @staticmethod
17 def an_ec2_rule(): 20 def an_ec2_rule():
@@ -41,4 +44,5 @@ class FakeEC2RuleBuilder():
41 44
42 def build(self): 45 def build(self):
43 grants = [self.GroupOrCIDR(self.ip_range, self.allowed_security_group_id)] 46 grants = [self.GroupOrCIDR(self.ip_range, self.allowed_security_group_id)]
44 return self.EC2Rule(self.ip_protocol, self.from_port, self.to_port, grants, self.parent) 47 return self.EC2Rule(self.ip_protocol, self.from_port, self.to_port, grants,
48 self.parent, self.item, self.ip_ranges, self.groups)
diff --git a/tests/unit/test_openstack_rule_transformer.py b/tests/unit/test_openstack_rule_transformer.py
index 6256455..887a3b2 100644
--- a/tests/unit/test_openstack_rule_transformer.py
+++ b/tests/unit/test_openstack_rule_transformer.py
@@ -3,7 +3,7 @@ import unittest
3from nova.virt.ec2.openstack_rule_transformer import OpenstackRuleTransformer 3from nova.virt.ec2.openstack_rule_transformer import OpenstackRuleTransformer
4 4
5 5
6class TestEC2RuleTransformer(unittest.TestCase): 6class TestOpenstackRuleTransformer(unittest.TestCase):
7 7
8 def setUp(self): 8 def setUp(self):
9 self.openstack_rule_transformer = OpenstackRuleTransformer() 9 self.openstack_rule_transformer = OpenstackRuleTransformer()