def test_valid_data(self): form = TextNoteForm({"text": "LOREM IPSUM"}) self.assertTrue(form.is_valid()) note = form.save() self.assertEqual(note.text, "LOREMIPSUM")
def test_only_lowercase(self): form = TextNoteForm({"text": "only lowercase note"}) self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'text': [u'Field can not be empty and ' 'must contain at least 10 ' 'uppercase symbols!']})
def test_less_then_10_chars(self): form = TextNoteForm({"text": "NINE CHARS"}) self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'text': [(u'It must be at least 10 ' u'uppercase symbols!')]})
def test_blank_data(self): form = TextNoteForm({}) self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'text': [u'Field can not be empty and ' 'must contain at least 10 ' 'uppercase symbols!']})