Skip to content

Commit

Permalink
Merge branch 'refactor-catalogue-item-e2e-tests-#342' into refactor-i…
Browse files Browse the repository at this point in the history
…tem-repo-unit-tests-#345
  • Loading branch information
joelvdavies committed Aug 14, 2024
2 parents db342d1 + 5512b26 commit d9434d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
7 changes: 4 additions & 3 deletions test/e2e/test_catalogue_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_catalogue_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions test/unit/repositories/test_catalogue_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/unit/services/test_catalogue_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9434d8

Please sign in to comment.