tools/qvm-firewall: make 'list' a default action

This commit is contained in:
Marek Marczykowski-Górecki 2018-04-30 04:16:23 +02:00
parent 7f79075088
commit ab79bd2a44
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 3 additions and 3 deletions

View File

@ -110,7 +110,7 @@ class TC_10_qvm_firewall(qubesadmin.tests.QubesTestCase):
' - -', ' - -',
]) ])
def test_001_list(self): def test_001_list_default(self):
self.app.expected_calls[('test-vm', 'admin.vm.firewall.Get', self.app.expected_calls[('test-vm', 'admin.vm.firewall.Get',
None, None)] = \ None, None)] = \
b'0\0action=accept dsthost=qubes-os.org proto=tcp ' \ b'0\0action=accept dsthost=qubes-os.org proto=tcp ' \
@ -118,7 +118,7 @@ class TC_10_qvm_firewall(qubesadmin.tests.QubesTestCase):
b'action=drop proto=icmp icmptype=8\n' \ b'action=drop proto=icmp icmptype=8\n' \
b'action=accept specialtarget=dns comment=Allow DNS\n' b'action=accept specialtarget=dns comment=Allow DNS\n'
with qubesadmin.tests.tools.StdoutBuffer() as stdout: with qubesadmin.tests.tools.StdoutBuffer() as stdout:
qubesadmin.tools.qvm_firewall.main(['test-vm', 'list'], app=self.app) qubesadmin.tools.qvm_firewall.main(['test-vm'], app=self.app)
self.assertEqual( self.assertEqual(
[l.strip() for l in stdout.getvalue().splitlines()], [l.strip() for l in stdout.getvalue().splitlines()],
['NO ACTION HOST PROTOCOL PORT(S) SPECIAL ' ['NO ACTION HOST PROTOCOL PORT(S) SPECIAL '

View File

@ -189,7 +189,7 @@ def main(args=None, app=None):
rules_add(vm, args) rules_add(vm, args)
elif args.command == 'del': elif args.command == 'del':
rules_del(vm, args) rules_del(vm, args)
elif args.command == 'list': else:
if args.raw: if args.raw:
rules_list_raw(vm) rules_list_raw(vm)
else: else: