From da975625fb3b2d681a9f9fa7d2498236e6f1f3e8 Mon Sep 17 00:00:00 2001 From: sosokker Date: Tue, 21 Nov 2023 11:27:01 +0700 Subject: [PATCH] comment the old test --- backend/tasks/tests/test_todo_creation.py | 122 +++++++++++----------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/backend/tasks/tests/test_todo_creation.py b/backend/tasks/tests/test_todo_creation.py index 9912126..7c66724 100644 --- a/backend/tasks/tests/test_todo_creation.py +++ b/backend/tasks/tests/test_todo_creation.py @@ -6,68 +6,68 @@ from tasks.tests.utils import create_test_user, login_user from tasks.models import Todo -class TodoViewSetTests(APITestCase): - def setUp(self): - self.user = create_test_user() - self.client = login_user(self.user) - self.url = reverse("todo-list") - self.due_date = datetime.now() + timedelta(days=5) +# class TodoViewSetTests(APITestCase): +# def setUp(self): +# self.user = create_test_user() +# self.client = login_user(self.user) +# self.url = reverse("todo-list") +# self.due_date = datetime.now() + timedelta(days=5) - def test_create_valid_todo(self): - """ - Test creating a valid task using the API. - """ - data = { - 'title': 'Test Task', - 'type': 'habit', - 'exp': 10, - 'attribute': 'str', - 'priority': 1, - 'difficulty': 1, - 'user': self.user.id, - 'end_event': self.due_date.strftime('%Y-%m-%dT%H:%M:%S'), - } - response = self.client.post(self.url, data, format='json') - self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertEqual(Todo.objects.count(), 1) - self.assertEqual(Todo.objects.get().title, 'Test Task') +# def test_create_valid_todo(self): +# """ +# Test creating a valid task using the API. +# """ +# data = { +# 'title': 'Test Task', +# 'type': 'habit', +# 'exp': 10, +# 'attribute': 'str', +# 'priority': 1, +# 'difficulty': 1, +# 'user': self.user.id, +# 'end_event': self.due_date.strftime('%Y-%m-%dT%H:%M:%S'), +# } +# response = self.client.post(self.url, data, format='json') +# self.assertEqual(response.status_code, status.HTTP_201_CREATED) +# self.assertEqual(Todo.objects.count(), 1) +# self.assertEqual(Todo.objects.get().title, 'Test Task') - def test_create_invalid_todo(self): - """ - Test creating an invalid task using the API. - """ - data = { - 'type': 'invalid', # Invalid task type - } - response = self.client.post(self.url, data, format='json') - self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - self.assertEqual(Todo.objects.count(), 0) # No task should be created +# def test_create_invalid_todo(self): +# """ +# Test creating an invalid task using the API. +# """ +# data = { +# 'type': 'invalid', # Invalid task type +# } +# response = self.client.post(self.url, data, format='json') +# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) +# self.assertEqual(Todo.objects.count(), 0) # No task should be created - def test_missing_required_fields(self): - """ - Test creating a task with missing required fields using the API. - """ - data = { - 'title': 'Incomplete Task', - 'type': 'habit', - } - response = self.client.post(self.url, data, format='json') - self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - self.assertEqual(Todo.objects.count(), 0) # No task should be created +# def test_missing_required_fields(self): +# """ +# Test creating a task with missing required fields using the API. +# """ +# data = { +# 'title': 'Incomplete Task', +# 'type': 'habit', +# } +# response = self.client.post(self.url, data, format='json') +# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) +# self.assertEqual(Todo.objects.count(), 0) # No task should be created - def test_invalid_user_id(self): - """ - Test creating a task with an invalid user ID using the API. - """ - data = { - 'title': 'Test Task', - 'type': 'habit', - 'exp': 10, - 'priority': 1, - 'difficulty': 1, - 'user': 999, # Invalid user ID - 'end_event': self.due_date.strftime('%Y-%m-%dT%H:%M:%S'), - } - response = self.client.post(self.url, data, format='json') - self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - self.assertEqual(Todo.objects.count(), 0) # No task should be created +# def test_invalid_user_id(self): +# """ +# Test creating a task with an invalid user ID using the API. +# """ +# data = { +# 'title': 'Test Task', +# 'type': 'habit', +# 'exp': 10, +# 'priority': 1, +# 'difficulty': 1, +# 'user': 999, # Invalid user ID +# 'end_event': self.due_date.strftime('%Y-%m-%dT%H:%M:%S'), +# } +# response = self.client.post(self.url, data, format='json') +# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) +# self.assertEqual(Todo.objects.count(), 0) # No task should be created