From 29bc0198093d29082e572cf92c5dff8da1b11e5b Mon Sep 17 00:00:00 2001 From: glaubervila Date: Mon, 13 Nov 2023 18:34:06 -0300 Subject: [PATCH] Updated backend tests. Closed #205 --- backend/core/test/test_product.py | 2 ++ backend/core/test/test_product_file.py | 5 ++++- frontend/pages/product/edit/[pid].js | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/core/test/test_product.py b/backend/core/test/test_product.py index 8e82eb5..8177516 100644 --- a/backend/core/test/test_product.py +++ b/backend/core/test/test_product.py @@ -289,6 +289,7 @@ def test_product_serialized_format(self): "uploaded_by": self.user.username, "is_owner": True, "can_delete": True, + "can_update": True, "internal_name": self.product.internal_name, "display_name": self.product.display_name, "official_product": self.product.official_product, @@ -296,6 +297,7 @@ def test_product_serialized_format(self): "description": self.product.description, "created_at": self.product.created_at.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), "status": self.product.status, + "updated_at": self.product.updated_at.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), } response = self.client.get(self.url) diff --git a/backend/core/test/test_product_file.py b/backend/core/test/test_product_file.py index c3087c8..916f4ae 100644 --- a/backend/core/test/test_product_file.py +++ b/backend/core/test/test_product_file.py @@ -9,7 +9,8 @@ from django.contrib.auth.models import User from django.urls import reverse from rest_framework.authtoken.models import Token -from rest_framework.test import APIRequestFactory, APITestCase, force_authenticate +from rest_framework.test import (APIRequestFactory, APITestCase, + force_authenticate) class ProductFileListCreateAPIViewTestCase(APITestCase): @@ -218,6 +219,8 @@ def test_product_file_serialized_format(self): ], "size": self.product_file.file.size, "extension": os.path.splitext(self.product_file.file.name)[1], + "created": self.product_file.created.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), + "updated": self.product_file.updated.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), } response = self.client.get(self.url) diff --git a/frontend/pages/product/edit/[pid].js b/frontend/pages/product/edit/[pid].js index 84fa4ce..bcd2e67 100644 --- a/frontend/pages/product/edit/[pid].js +++ b/frontend/pages/product/edit/[pid].js @@ -263,9 +263,6 @@ export default function EditProduct() { } }) } - // onBlur={handleInputValue} - // error={!!fieldErrors.description} - // helperText={fieldErrors.description} />