[test] make assertions on exception message
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Tue, 25 Apr 2017 17:11:18 +0200
changeset 12180 72a890b713c1
parent 12179 14f85569eda2
child 12181 29dae4b0332a
[test] make assertions on exception message
cubicweb/test/unittest_req.py
--- a/cubicweb/test/unittest_req.py	Tue Apr 25 17:10:16 2017 +0200
+++ b/cubicweb/test/unittest_req.py	Tue Apr 25 17:11:18 2017 +0200
@@ -147,13 +147,19 @@
             users = list(users)
             self.assertEqual(len(users), 2)
 
-            with self.assertRaises(AssertionError):
+            with self.assertRaisesRegexp(
+                AssertionError, '^chapeau not in CWUser subject relations$'
+            ):
                 req.find('CWUser', chapeau=u"melon")
 
-            with self.assertRaises(AssertionError):
+            with self.assertRaisesRegexp(
+                AssertionError, '^buddy not in CWUser object relations$'
+            ):
                 req.find('CWUser', reverse_buddy=users[0])
 
-            with self.assertRaises(NotImplementedError):
+            with self.assertRaisesRegexp(
+                NotImplementedError, '^in_group: list of values are not supported$'
+            ):
                 req.find('CWUser', in_group=[1, 2])