Skip to content

Commit

Permalink
Address further comments of missed IDs and misnamed test #314
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Jul 26, 2024
1 parent 6dfdddc commit 3d16ff1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/e2e/test_catalogue_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def setup(self, test_client):
self.unit_value_id_dict = {}

def post_unit(self, unit_post_data: dict) -> None:
"""Posts a unit with the given data and stores the value and id in a dictionary for lookup later.
"""Posts a unit with the given data and stores the value and ID in a dictionary for lookup later.
:param unit_post_data: Dictionary containing the unit data as would be required for a `UnitPostSchema`.
"""
Expand All @@ -62,7 +62,7 @@ def post_unit(self, unit_post_data: dict) -> None:

def add_unit_value_and_id(self, unit_value: str, unit_id: str) -> None:
"""
Stores a unit value and id inside the `unit_value_id_dict` for tests that need to have a
Stores a unit value and ID inside the `unit_value_id_dict` for tests that need to have a
non-existent or invalid unit ID.
:param unit_value: Value of the unit.
Expand All @@ -73,7 +73,7 @@ def add_unit_value_and_id(self, unit_value: str, unit_id: str) -> None:

def post_catalogue_category(self, catalogue_category_data: dict) -> Optional[str]:
"""
Posts a catalogue category with the given data and returns the id of the created catalogue category if
Posts a catalogue category with the given data and returns the ID of the created catalogue category if
successful.
:param catalogue_category_data: Dictionary containing the basic catalogue category data as would be required
Expand Down Expand Up @@ -185,8 +185,8 @@ def test_create_with_valid_parent_id(self):
{**CATALOGUE_CATEGORY_GET_DATA_NON_LEAF_REQUIRED_VALUES_ONLY, "parent_id": parent_id}
)

def test_create_with_non_leaf_parent(self):
"""Test creating a catalogue category with a non-leaf parent."""
def test_create_with_eaf_parent(self):
"""Test creating a catalogue category with a leaf parent."""

parent_id = self.post_catalogue_category(
{**CATALOGUE_CATEGORY_POST_DATA_NON_LEAF_REQUIRED_VALUES_ONLY, "is_leaf": True}
Expand Down Expand Up @@ -247,14 +247,14 @@ def test_create_leaf_with_properties(self):
self.check_post_catalogue_category_success(CATALOGUE_CATEGORY_GET_DATA_LEAF_NO_PARENT_WITH_PROPERTIES_MM)

def test_create_leaf_with_properties_with_non_existent_unit_id(self):
"""Test creating a leaf catalogue category with a property with a non-existent unit id provided."""
"""Test creating a leaf catalogue category with a property with a non-existent unit ID provided."""

self.add_unit_value_and_id("mm", str(ObjectId()))
self.post_catalogue_category(CATALOGUE_CATEGORY_DATA_LEAF_NO_PARENT_WITH_PROPERTIES_MM)
self.check_post_catalogue_category_failed_with_detail(422, "The specified unit does not exist")

def test_create_leaf_with_properties_with_invalid_unit_id(self):
"""Test creating a leaf catalogue category with a property with an invalid unit id provided."""
"""Test creating a leaf catalogue category with a property with an invalid unit ID provided."""

self.add_unit_value_and_id("mm", "invalid-id")
self.post_catalogue_category(CATALOGUE_CATEGORY_DATA_LEAF_NO_PARENT_WITH_PROPERTIES_MM)
Expand Down Expand Up @@ -871,7 +871,7 @@ def test_partial_update_parent_id_to_child_of_self(self):
)

def test_partial_update_parent_id_to_leaf(self):
"""Test updating the `parent_id` of a catalogue category to the id of a leaf catalogue category."""
"""Test updating the `parent_id` of a catalogue category to the ID of a leaf catalogue category."""

parent_id = self.post_catalogue_category(CATALOGUE_CATEGORY_POST_DATA_LEAF_NO_PARENT_NO_PROPERTIES)
catalogue_category_id = self.post_catalogue_category(CATALOGUE_CATEGORY_POST_DATA_LEAF_REQUIRED_VALUES_ONLY)
Expand Down Expand Up @@ -1114,7 +1114,7 @@ def test_partial_update_leaf_with_properties_with_non_existent_unit_id(self):
self.check_patch_catalogue_category_failed_with_detail(422, "The specified unit does not exist")

def test_partial_update_leaf_with_properties_with_invalid_unit_id(self):
"""Test updating a leaf catalogue category's properties to have a property with an invalid unit id provided."""
"""Test updating a leaf catalogue category's properties to have a property with an invalid unit ID provided."""

self.add_unit_value_and_id("mm", "invalid-id")
catalogue_category_id = self.post_catalogue_category(CATALOGUE_CATEGORY_POST_DATA_LEAF_NO_PARENT_NO_PROPERTIES)
Expand Down

0 comments on commit 3d16ff1

Please sign in to comment.