From 59e080c4f3e44a86ca7cdef493d9e64350b5c1c0 Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Tue, 3 Sep 2024 13:25:39 +0000 Subject: [PATCH] Address comments #340 --- .../repositories/test_catalogue_category.py | 28 ++++++++++++------- test/unit/repositories/test_catalogue_item.py | 7 ++--- 2 files changed, 20 insertions(+), 15 deletions(-) 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/repositories/test_catalogue_item.py b/test/unit/repositories/test_catalogue_item.py index 41571259..e983855c 100644 --- a/test/unit/repositories/test_catalogue_item.py +++ b/test/unit/repositories/test_catalogue_item.py @@ -646,7 +646,7 @@ class ListIDsDSL(CatalogueItemRepoDSL): """Base class for `list_ids` tests""" _list_ids_catalogue_category_id: str - _list_ids_result: bool + _list_ids_result: list[ObjectId] def call_list_ids(self, catalogue_category_id: str) -> None: """Calls the `CatalogueItemRepo` `list_ids` method. @@ -660,10 +660,7 @@ def call_list_ids(self, catalogue_category_id: str) -> None: ) def check_list_ids_success(self) -> None: - """Checks that a prior call to `call_list_ids` worked as expected. - - :param expected_result: The expected result returned by `list_ids`. - """ + """Checks that a prior call to `call_list_ids` worked as expected.""" self.catalogue_items_collection.find.assert_called_once_with( {"catalogue_category_id": CustomObjectId(self._list_ids_catalogue_category_id)},