From 3f242e3cdb6a5ecee94125698787835d8c9fd8ae Mon Sep 17 00:00:00 2001 From: Matias Vallejos Date: Mon, 29 Jan 2024 16:29:50 -0300 Subject: [PATCH] Solve Lint conflicts --- app/todo_api/tests/test_task_list_api.py | 16 +++++----------- app/todo_api/views.py | 5 +++-- app/todo_project/wsgi.py | 18 ------------------ 3 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 app/todo_project/wsgi.py diff --git a/app/todo_api/tests/test_task_list_api.py b/app/todo_api/tests/test_task_list_api.py index 9cb40ad..174f9ee 100644 --- a/app/todo_api/tests/test_task_list_api.py +++ b/app/todo_api/tests/test_task_list_api.py @@ -1,4 +1,3 @@ -from venv import create from django.test import TestCase from django.urls import reverse from django.contrib.auth import get_user_model @@ -93,7 +92,6 @@ def test_retrieve_list_pk_from_name(self): self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(list_2.id, res.data["id"]) - def test_retrieve_inbox_from_name(self): """Test retrieve and create if inbox not exists using slug name""" @@ -103,7 +101,7 @@ def test_retrieve_inbox_from_name(self): self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertTrue(exists) - + def test_retrieve_unique_inbox_for_each_account(self): """Test retrieve and create unique inbox for account""" user_two = get_user_model().objects.create( @@ -118,13 +116,11 @@ def test_retrieve_unique_inbox_for_each_account(self): self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertTrue(exists) self.assertNotEqual(list_inbox.list_uuid, list[0].list_uuid) - + def test_fully_update_task_list(self): """Test partial update list with patch""" list = create_task_list(user=self.user) - payload = { - "name": "New name" - } + payload = {"name": "New name"} url = list_detail_url(list.list_uuid) res = self.client.patch(url, payload) self.assertEqual(res.status_code, status.HTTP_200_OK) @@ -137,8 +133,6 @@ def test_update_unauthorized_failure(self): ) list = create_task_list(user=new_user) url = list_detail_url(list.list_uuid) - res = self.client.patch(url, { - "name": "new name" - }) + res = self.client.patch(url, {"name": "new name"}) self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND) - self.assertNotEqual(list.name, "new name") \ No newline at end of file + self.assertNotEqual(list.name, "new name") diff --git a/app/todo_api/views.py b/app/todo_api/views.py index 653fbba..80f1f1a 100644 --- a/app/todo_api/views.py +++ b/app/todo_api/views.py @@ -143,7 +143,9 @@ def retrieve(self, request, list_uuid=None, *args, **kwargs): try: if list_uuid == "inbox": # case inbox os is not created - inbox = TaskList.objects.filter(name="inbox", created_by=self.request.user).exists() # noqa: E501 + inbox = TaskList.objects.filter( + name="inbox", created_by=self.request.user + ).exists() # noqa: E501 if not inbox: TaskList.objects.create(name="inbox", created_by=self.request.user) queryset = queryset.get(name__iexact="inbox") @@ -155,4 +157,3 @@ def retrieve(self, request, list_uuid=None, *args, **kwargs): ) serializer = self.get_serializer(queryset, many=False) return Response(serializer.data) - \ No newline at end of file diff --git a/app/todo_project/wsgi.py b/app/todo_project/wsgi.py deleted file mode 100644 index b3ed5db..0000000 --- a/app/todo_project/wsgi.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -WSGI config for todo_project project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_project.settings') - -application = get_wsgi_application() - -app=application \ No newline at end of file