Skip to content

Commit

Permalink
test9
Browse files Browse the repository at this point in the history
  • Loading branch information
budhrajaankita committed Apr 22, 2024
1 parent f695a08 commit ae15c64
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit ae15c64

Please sign in to comment.