tests: make firewall tests working regardless of python version

Don't depend on set ordering...
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-20 12:56:23 +02:00
parent dc8047c3bb
commit 87efe51be0
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1,4 +1,5 @@
import logging
import operator
from unittest import TestCase
import qubesagent.firewall
@ -275,18 +276,20 @@ class TestIptablesWorker(TestCase):
self.obj.called_commands[4] = []
self.obj.called_commands[6] = []
self.obj.cleanup()
self.assertEqual(self.obj.called_commands[4],
self.assertEqual([self.obj.called_commands[4][0]] +
sorted(self.obj.called_commands[4][1:], key=operator.itemgetter(1)),
[['-F', 'QBS-FORWARD'],
['-F', 'chain-ip4-1'],
['-X', 'chain-ip4-1'],
['-F', 'chain-ip4-2'],
['-X', 'chain-ip4-2']])
self.assertEqual(self.obj.called_commands[6],
self.assertEqual([self.obj.called_commands[6][0]] +
sorted(self.obj.called_commands[6][1:], key=operator.itemgetter(1)),
[['-F', 'QBS-FORWARD'],
['-F', 'chain-ip6-2'],
['-X', 'chain-ip6-2'],
['-F', 'chain-ip6-1'],
['-X', 'chain-ip6-1']])
['-X', 'chain-ip6-1'],
['-F', 'chain-ip6-2'],
['-X', 'chain-ip6-2']])
class TestNftablesWorker(TestCase):