Exemplo n.º 1
0
 def test_valid_data(self):
     form = TextNoteForm({"text": "LOREM IPSUM"})
     self.assertTrue(form.is_valid())
     note = form.save()
     self.assertEqual(note.text, "LOREMIPSUM")
Exemplo n.º 2
0
 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!']})
Exemplo n.º 3
0
 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!')]})
Exemplo n.º 4
0
 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!']})