def test_valid_topic_form(self): data = { "title": "Test Topic Title", "subtitle": "Test Topic Subtitle", "tags": "test,topic,tags", "text": "Test Topic Text", } form = TopicForm(data=data) self.assertTrue(form.is_valid())
def test_invalid_topic_form_missing_text(self): """Test when text is missing""" data = { "title": "Test Topic Title", "subtitle": "Test Topic Subtitle", "tags": "test,topic,tags", } form = TopicForm(data=data) self.assertFalse(form.is_valid())
def test_invalid_topic_form_missing_text(self): """ Test when text is missing """ data = { 'title': 'Test Topic Title', 'subtitle': 'Test Topic Subtitle', 'tags': 'test,topic,tags', } form = TopicForm(data=data) self.assertFalse(form.is_valid())
def test_valid_topic_form_empty_tags(self): data = { 'title': 'Test Topic Title', 'subtitle': 'Test Topic Subtitle', 'tags': '', 'text': 'Test Topic Text' } form = TopicForm(data=data) self.assertTrue(form.is_valid())
def test_invalid_topic_form_text_too_long(self): """Test when text runs over the length limit""" data = { "title": "Test Topic Title", "subtitle": "Test Topic Subtitle", "tags": "test,topic,tags", "text": text_too_long, } form = TopicForm(data=data) self.assertFalse(form.is_valid())
def test_invalid_topic_form_empty_text(self): """ Test when text contains only whitespace """ data = { "title": "Test Topic Title", "subtitle": "Test Topic Subtitle", "tags": "test,topic,tags", "text": " " } form = TopicForm(data=data) self.assertFalse(form.is_valid())
def test_invalid_topic_form_text_too_long(self): """ Test when text runs over the length limit """ data = { 'title': 'Test Topic Title', 'subtitle': 'Test Topic Subtitle', 'tags': 'test,topic,tags', 'text': text_too_long, } form = TopicForm(data=data) self.assertFalse(form.is_valid())
def test_invalid_topic_form_empty_text(self): """ Test when text contains only whitespace """ data = { 'title': 'Test Topic Title', 'subtitle': 'Test Topic Subtitle', 'tags': 'test,topic,tags', 'text': ' ' } form = TopicForm(data=data) self.assertFalse(form.is_valid())