From ae15c646a743026bb88c03e198eb798d73a52010 Mon Sep 17 00:00:00 2001 From: "budhraja.ankita" Date: Mon, 22 Apr 2024 03:05:44 -0700 Subject: [PATCH] test9 --- tasks/tests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tasks/tests.py b/tasks/tests.py index 86315bb..2124964 100644 --- a/tasks/tests.py +++ b/tasks/tests.py @@ -65,3 +65,17 @@ def test_form_blank_data(self): self.assertFalse(form.is_valid()) self.assertEqual(len(form.errors), 1) + +class TaskUpdateTest(TestCase): + def setUp(self): + self.task = Task.objects.create(title="Test Task", description="Update Test Description", completed=True) + + def test_task_update_view(self): + response = self.client.post(reverse('task_update', args=[self.task.id]), { + 'title': "Updated Title", + 'description': self.task.description, + 'completed': self.task.completed + }) + self.assertEqual(response.status_code, 302) + self.task.refresh_from_db() + self.assertEqual(self.task.title, "Updated Title") \ No newline at end of file