I am relatively new to Python and want to use a
u = createUser(False)
de = createDailyEntry(u, "188.8.131.52", 1)
with self.assertRaises(ValidationError) as cm:
# this line bombs - message doesn't exist. I also tried "error_code" like I saw in the documentation, but that doesn't work
You can just use
with self.assertRaisesRegexp(ValidationError, "Both"): de.full_clean()
When you use it as a context manager the 2nd argument is a regular expression to search through the exception's string representation.