Created
October 23, 2021 15:48
-
-
Save aliceridgway/17df919faca871e7b7d09b013d621ac4 to your computer and use it in GitHub Desktop.
Django Todo App - model tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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