class TodoItemTestCase(TestCase): def setUp(self): self.todo_item = TodoItem(title="title", description="description", status="TODO") def test_todo_has_a_non_null_creation_date(self): todo = TodoItem.objects.create() self.assertNotEqual(todo.created_at, None) def test_todo_cannot_have_a_long_title(self): self.todo_item.title = "this is a long title and should not be accepted when validating because it is too looooong" with self.assertRaises(ValidationError): self.todo_item.full_clean() def test_todo_validates(self): self.todo_item.full_clean()
def setUp(self): self.todo_item = TodoItem(title="title", description="description", status="TODO")