def test_clean_pass(self): publication = mock.Mock(spec=Publication) publication.title = 'Title' publication.pdf_creation = File(BytesIO(), name='lol') publication.source_creation = File(BytesIO(), name='lol') # just pass the test Publication.clean(publication)
def test_clean_error(self): publication = mock.Mock(spec=Publication) publication.title = 'Title' publication.pdf_creation = File(BytesIO(), name='lol') publication.source_creation = None with self.assertRaises(ValidationError): Publication.clean(publication)