Example #1
0
 def test_validate_name(self, m_cnq):
     m_cnq.return_value = "CN Exists."
     field = mock.MagicMock()
     self = mock.MagicMock()
     field.data = "CN Exists."
     with pytest.raises(ValidationError):
         EditCommonNameForm.validate_name(self=self, field=field)
Example #2
0
 def test_validate_synonyms_string(self):
     """Raise ValidationError if any synonyms are too long."""
     field = mock.MagicMock()
     field.data = "Digitalis"
     EditCommonNameForm.validate_synonyms_string(None, field)
     field.data = (
         "Digitalis, He just kept talking in one long "
         "incredibly unbroken sentence moving from topic "
         "to topic so that no one had a chance to interrupt"
     )
     with pytest.raises(ValidationError):
         EditCommonNameForm.validate_synonyms_string(None, field)