PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/modeltests/validation/test_custom_messages.py

https://code.google.com/p/mango-py/
Python | 13 lines | 9 code | 4 blank | 0 comment | 0 complexity | 9b33edba904fcb323ce5fb4a639d5d9d MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from modeltests.validation import ValidationTestCase
  2. from models import CustomMessagesModel
  3. class CustomMessagesTest(ValidationTestCase):
  4. def test_custom_simple_validator_message(self):
  5. cmm = CustomMessagesModel(number=12)
  6. self.assertFieldFailsValidationWithMessage(cmm.full_clean, 'number', ['AAARGH'])
  7. def test_custom_null_message(self):
  8. cmm = CustomMessagesModel()
  9. self.assertFieldFailsValidationWithMessage(cmm.full_clean, 'number', ['NULL'])