tests: improve test failure message

When multiple Admin API calls are expected, but not all were made, show
which were missing.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-06 21:38:23 +02:00
parent b35303ff62
commit a3e3dac6dc
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -158,8 +158,10 @@ class QubesTestCase(unittest.TestCase):
set(self.app.expected_calls.keys()),
set(self.app.actual_calls))
# and also check if calls expected multiple times were called
self.assertFalse(any(x for x in self.app.expected_calls.values() if
isinstance(x, list)))
self.assertFalse([(call, ret)
for call, ret in self.app.expected_calls.items() if
isinstance(ret, list) and ret],
'Some calls not called expected number of times')
def assertNotRaises(self, excClass, callableObj=None, *args, **kwargs):
"""Fail if an exception of class excClass is raised