@@ -17,10 +17,14 @@ def test_list_firewalls(self):
1717
1818 self .assert_no_fail (result )
1919 self .assertEqual (json .loads (result .output ),
20- [{'type' : 'VLAN - dedicated' ,
20+ [{'features' : ['HA' ],
21+ 'firewall id' : 'vlan:1234' ,
2122 'server/vlan id' : 1 ,
22- 'features' : ['HA' ],
23- 'firewall id' : 'vlan:1234' },
23+ 'type' : 'VLAN - dedicated' },
24+ {'features' : ['HA' ],
25+ 'firewall id' : 'vlan:23456' ,
26+ 'server/vlan id' : 3 ,
27+ 'type' : 'VLAN - dedicated' },
2428 {'features' : '-' ,
2529 'firewall id' : 'vs:1234' ,
2630 'server/vlan id' : 1 ,
@@ -50,3 +54,42 @@ def test_add_server(self, confirm_mock):
5054 result = self .run_command (['firewall' , 'add' , '1000' , '--firewall-type=server' ])
5155 self .assert_no_fail (result )
5256 self .assertIn ("Firewall is being created!" , result .output )
57+
58+ def test_detail (self ):
59+ result = self .run_command (['firewall' , 'detail' , 'vlan:1234' ])
60+ self .assert_no_fail (result )
61+ self .assertEqual (json .loads (result .output ),
62+ [{'#' : 1 ,
63+ 'action' : 'permit' ,
64+ 'dest' : 'any on server:80-80' ,
65+ 'dest_mask' : '255.255.255.255' ,
66+ 'protocol' : 'tcp' ,
67+ 'src_ip' : '0.0.0.0' ,
68+ 'src_mask' : '0.0.0.0' },
69+ {'#' : 2 ,
70+ 'action' : 'permit' ,
71+ 'dest' : 'any on server:1-65535' ,
72+ 'dest_mask' : '255.255.255.255' ,
73+ 'protocol' : 'tmp' ,
74+ 'src_ip' : '193.212.1.10' ,
75+ 'src_mask' : '255.255.255.255' },
76+ {'#' : 3 ,
77+ 'action' : 'permit' ,
78+ 'dest' : 'any on server:80-800' ,
79+ 'dest_mask' : '255.255.255.255' ,
80+ 'protocol' : 'tcp' ,
81+ 'src_ip' : '0.0.0.0' ,
82+ 'src_mask' : '0.0.0.0' }])
83+
84+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
85+ def test_cancel_firewall (self , confirm_mock ):
86+ confirm_mock .return_value = True
87+ result = self .run_command (['firewall' , 'cancel' , 'vlan:1234' ])
88+ self .assert_no_fail (result )
89+ self .assertIn ("Firewall with id vlan:1234 is being cancelled!" , result .output )
90+
91+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
92+ def test_edit (self , confirm_mock ):
93+ confirm_mock .return_value = True
94+ result = self .run_command (['firewall' , 'edit' , 'vlan:1234' ])
95+ print (result .output )
0 commit comments