Skip to content

Instantly share code, notes, and snippets.

@aliceridgway
Created October 23, 2021 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliceridgway/17df919faca871e7b7d09b013d621ac4 to your computer and use it in GitHub Desktop.
Save aliceridgway/17df919faca871e7b7d09b013d621ac4 to your computer and use it in GitHub Desktop.
Django Todo App - model tests
from django.test import TestCase
from .models import Todo
# Create your tests here.
todo_title = "Book Dentist Appointment"
class TestTodoModel(TestCase):
def setUp(self):
self.todo = Todo.objects.create(
title=todo_title
)
def test_todo_created(self):
self.assertEqual(self.todo.title, todo_title)
def test_date_automatically_assigned(self):
self.assertTrue(self.todo.created_on)
def test_status_assigned(self):
self.assertEqual(self.todo.completed, False)
def test_str(self):
self.assertEqual(str(self.todo), todo_title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment