add some checks for QubesDB /qubes-firewall_handled/[ip]
This commit is contained in:
parent
3067e469d3
commit
0993115bdc
@ -675,11 +675,17 @@ class TestFirewallWorker(TestCase):
|
|||||||
def test_handle_addr(self):
|
def test_handle_addr(self):
|
||||||
self.obj.handle_addr('10.137.0.2')
|
self.obj.handle_addr('10.137.0.2')
|
||||||
self.assertEqual(self.obj.rules['10.137.0.2'], [{'action': 'accept'}])
|
self.assertEqual(self.obj.rules['10.137.0.2'], [{'action': 'accept'}])
|
||||||
|
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.2'], '1')
|
||||||
|
self.obj.handle_addr('10.137.0.2')
|
||||||
|
self.assertEqual(self.obj.rules['10.137.0.2'], [{'action': 'accept'}])
|
||||||
|
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.2'], '2')
|
||||||
# fallback to block all
|
# fallback to block all
|
||||||
self.obj.handle_addr('10.137.0.3')
|
self.obj.handle_addr('10.137.0.3')
|
||||||
self.assertEqual(self.obj.rules['10.137.0.3'], [{'action': 'drop'}])
|
self.assertEqual(self.obj.rules['10.137.0.3'], [{'action': 'drop'}])
|
||||||
|
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.3'], '1')
|
||||||
self.obj.handle_addr('10.137.0.4')
|
self.obj.handle_addr('10.137.0.4')
|
||||||
self.assertEqual(self.obj.rules['10.137.0.4'], [{'action': 'drop'}])
|
self.assertEqual(self.obj.rules['10.137.0.4'], [{'action': 'drop'}])
|
||||||
|
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.4'], '1')
|
||||||
|
|
||||||
@patch('os.path.isfile')
|
@patch('os.path.isfile')
|
||||||
@patch('os.access')
|
@patch('os.access')
|
||||||
|
Loading…
Reference in New Issue
Block a user