Skip to content

Commit

Permalink
Initial refactoring for items e2e update tests #347
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Aug 9, 2024
1 parent d712038 commit 84ec55c
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 344 deletions.
13 changes: 6 additions & 7 deletions test/e2e/test_catalogue_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
CATALOGUE_CATEGORY_PROPERTY_DATA_BOOLEAN_MANDATORY,
CATALOGUE_CATEGORY_PROPERTY_DATA_NUMBER_NON_MANDATORY_WITH_MM_UNIT,
CATALOGUE_ITEM_DATA_REQUIRED_VALUES_ONLY,
MANUFACTURER_POST_DATA_REQUIRED_VALUES_ONLY,
UNIT_POST_DATA_MM,
)
MANUFACTURER_POST_DATA_REQUIRED_VALUES_ONLY, UNIT_POST_DATA_MM)
from typing import Optional

import pytest
from bson import ObjectId
from fastapi.testclient import TestClient
from httpx import Response

from inventory_management_system_api.core.consts import BREADCRUMBS_TRAIL_MAX_LENGTH
from inventory_management_system_api.core.consts import \
BREADCRUMBS_TRAIL_MAX_LENGTH


class CreateDSL:
Expand Down Expand Up @@ -777,9 +776,9 @@ def check_patch_catalogue_category_response_success(self, expected_catalogue_cat
Checks that a prior call to `patch_catalogue_category` gave a successful response with the expected data
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.
:param expected_catalogue_category_get_data: Dictionary containing the expected catalogue category 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.
"""

assert self._patch_response_catalogue_category.status_code == 200
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/test_catalogue_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,13 @@ def patch_catalogue_item(self, catalogue_item_id: str, catalogue_item_update_dat
"""
Updates a catalogue item with the given ID.
:param catalogue_item_id: ID of the catalogue category to patch.
:param catalogue_item_id: ID of the catalogue item to patch.
:param catalogue_item_update_data: Dictionary containing the basic patch data as would be required for a
`CatalogueItemPatchSchema` but with any `id`'s replaced by the `name` value
in its properties as the IDs will be added automatically.
"""

# Replace any unit values with unit ids
# Replace any property names with ids
catalogue_item_update_data = E2ETestHelpers.replace_property_names_with_ids_in_properties(
catalogue_item_update_data, self.property_name_id_dict
)
Expand Down Expand Up @@ -793,10 +793,10 @@ def check_patch_catalogue_item_response_success(self, expected_catalogue_item_ge
Checks that a prior call to `patch_catalogue_item` gave a successful response with the expected data
returned.
:param expected_catalogue_item_get_data: Dictionary containing the expected system data returned as would
be required for a `CatalogueItemSchema`. Does not need mandatory IDs
(e.g. manufacturer_id) as they will be added automatically to check
they are as expected.
:param expected_catalogue_item_get_data: Dictionary containing the expected catalogue item data returned as
would be required for a `CatalogueItemSchema`. Does not need mandatory IDs
(e.g. `manufacturer_id`) as they will be added automatically to check they are
as expected.
"""

assert self._patch_response_catalogue_item.status_code == 200
Expand Down
Loading

0 comments on commit 84ec55c

Please sign in to comment.