Browse Source

Cameron & Ed | Delete more unused rule EC2 rule args in EC2RuleTransformer, fix TestOpenstackRuleTransformer class name

changes/85/139985/1
cameron-r 4 years ago
parent
commit
36649ae1fc

+ 4
- 1
ec2_rule_transformer.py View File

@@ -21,4 +21,7 @@ class EC2RuleTransformer:
21 21
 
22 22
     def _delete_unused_rule_args(self, rule_args):
23 23
         del rule_args['grants']
24
-        del rule_args['parent']
24
+        del rule_args['parent']
25
+        del rule_args['item']
26
+        del rule_args['ipRanges']
27
+        del rule_args['groups']

+ 6
- 2
tests/unit/fake_ec2_rule_builder.py View File

@@ -2,7 +2,7 @@ from collections import namedtuple
2 2
 
3 3
 class 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 6
     GroupOrCIDR = namedtuple('GroupOrCIDR', 'cidr_ip group_id')
7 7
 
8 8
     def __init__(self):
@@ -12,6 +12,9 @@ class FakeEC2RuleBuilder():
12 12
         self.ip_range = '0.0.0.0/0'
13 13
         self.allowed_security_group_id = None
14 14
         self.parent = None
15
+        self.item = '\n'
16
+        self.ip_ranges = '\n'
17
+        self.groups = ''
15 18
 
16 19
     @staticmethod
17 20
     def an_ec2_rule():
@@ -41,4 +44,5 @@ class FakeEC2RuleBuilder():
41 44
 
42 45
     def build(self):
43 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)

+ 1
- 1
tests/unit/test_openstack_rule_transformer.py View File

@@ -3,7 +3,7 @@ import unittest
3 3
 from nova.virt.ec2.openstack_rule_transformer import OpenstackRuleTransformer
4 4
 
5 5
 
6
-class TestEC2RuleTransformer(unittest.TestCase):
6
+class TestOpenstackRuleTransformer(unittest.TestCase):
7 7
 
8 8
     def setUp(self):
9 9
         self.openstack_rule_transformer = OpenstackRuleTransformer()

Loading…
Cancel
Save