From 5512b26c1b769528785d79d76369050f34ec4356 Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Wed, 14 Aug 2024 08:29:27 +0000 Subject: [PATCH] Address comments #342 --- test/e2e/test_catalogue_category.py | 7 +++-- test/e2e/test_catalogue_item.py | 2 +- .../repositories/test_catalogue_category.py | 28 ++++++++++++------- test/unit/services/test_catalogue_category.py | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/test/e2e/test_catalogue_category.py b/test/e2e/test_catalogue_category.py index b2caba25..77654330 100644 --- a/test/e2e/test_catalogue_category.py +++ b/test/e2e/test_catalogue_category.py @@ -131,8 +131,9 @@ def check_post_catalogue_category_success(self, expected_catalogue_category_get_ returned. :param expected_catalogue_category_get_data: Dictionary containing the expected system data returned as would - be required for a `CatalogueCategorySchema`. Does not need unit IDs - as they will be added automatically to check they are as expected. + be required for a `CatalogueCategorySchema`. Does not need + `unit_id`'s as they will be added automatically to check they are + as expected. """ assert self._post_response_catalogue_category.status_code == 201 @@ -698,7 +699,7 @@ def patch_catalogue_category(self, catalogue_category_id: str, catalogue_categor :param catalogue_category_id: ID of the catalogue category to patch. :param catalogue_category_update_data: Dictionary containing the basic patch data as would be required for a - `CatalogueCategoryPatchSchema` but with any unit_id's replaced by the + `CatalogueCategoryPatchSchema` but with any `unit_id`'s replaced by the `unit` value in its properties as the ids will be added automatically. """ diff --git a/test/e2e/test_catalogue_item.py b/test/e2e/test_catalogue_item.py index 20a1da86..06af44e4 100644 --- a/test/e2e/test_catalogue_item.py +++ b/test/e2e/test_catalogue_item.py @@ -235,7 +235,7 @@ def post_catalogue_item_and_prerequisites_with_allowed_values( ) -> Optional[str]: """ Utility method that posts a catalogue item with a property named 'property' of a given type with a given set of - allowed values as well as any prerequisite entities (a catalogue category and a manufacturer) + allowed values as well as any prerequisite entities (a catalogue category and a manufacturer). :param property_type: Type of the property to post. :param allowed_values_post_data: Dictionary containing the allowed values data as would be required for an diff --git a/test/unit/repositories/test_catalogue_category.py b/test/unit/repositories/test_catalogue_category.py index 24263925..beb7b025 100644 --- a/test/unit/repositories/test_catalogue_category.py +++ b/test/unit/repositories/test_catalogue_category.py @@ -12,27 +12,35 @@ CATALOGUE_CATEGORY_IN_DATA_NON_LEAF_NO_PARENT_NO_PROPERTIES_A, CATALOGUE_CATEGORY_IN_DATA_NON_LEAF_NO_PARENT_NO_PROPERTIES_B, CATALOGUE_CATEGORY_PROPERTY_IN_DATA_NUMBER_NON_MANDATORY_WITH_MM_UNIT, - CATALOGUE_ITEM_DATA_REQUIRED_VALUES_ONLY) + CATALOGUE_ITEM_DATA_REQUIRED_VALUES_ONLY, +) from test.unit.repositories.conftest import RepositoryTestHelpers from test.unit.repositories.test_utils import ( MOCK_BREADCRUMBS_QUERY_RESULT_LESS_THAN_MAX_LENGTH, - MOCK_MOVE_QUERY_RESULT_INVALID, MOCK_MOVE_QUERY_RESULT_VALID) + MOCK_MOVE_QUERY_RESULT_INVALID, + MOCK_MOVE_QUERY_RESULT_VALID, +) from typing import Optional from unittest.mock import MagicMock, Mock, call, patch import pytest from bson import ObjectId -from inventory_management_system_api.core.custom_object_id import \ - CustomObjectId +from inventory_management_system_api.core.custom_object_id import CustomObjectId from inventory_management_system_api.core.exceptions import ( - ChildElementsExistError, DuplicateRecordError, InvalidActionError, - InvalidObjectIdError, MissingRecordError) + ChildElementsExistError, + DuplicateRecordError, + InvalidActionError, + InvalidObjectIdError, + MissingRecordError, +) from inventory_management_system_api.models.catalogue_category import ( - CatalogueCategoryIn, CatalogueCategoryOut, CatalogueCategoryPropertyIn, - CatalogueCategoryPropertyOut) -from inventory_management_system_api.repositories.catalogue_category import \ - CatalogueCategoryRepo + CatalogueCategoryIn, + CatalogueCategoryOut, + CatalogueCategoryPropertyIn, + CatalogueCategoryPropertyOut, +) +from inventory_management_system_api.repositories.catalogue_category import CatalogueCategoryRepo class CatalogueCategoryRepoDSL: diff --git a/test/unit/services/test_catalogue_category.py b/test/unit/services/test_catalogue_category.py index 039db0ac..ddde07b4 100644 --- a/test/unit/services/test_catalogue_category.py +++ b/test/unit/services/test_catalogue_category.py @@ -483,7 +483,7 @@ def mock_update( :param catalogue_category_id: ID of the catalogue category that will be obtained. :param catalogue_category_update_data: Dictionary containing the basic patch data as would be required for a - `CatalogueCategoryPatchSchema` but with any unit_id's replaced by the + `CatalogueCategoryPatchSchema` but with any `unit_id`'s replaced by the `unit` value in its properties as the IDs will be added automatically. :param stored_catalogue_category_post_data: Dictionary containing the catalogue category data for the existing stored catalogue category as would be required for a