From 84ec55cdf5ab9d1db10b079ca48bc37ee4b50f8b Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Fri, 9 Aug 2024 12:54:10 +0000 Subject: [PATCH] Initial refactoring for items e2e update tests #347 --- test/e2e/test_catalogue_category.py | 13 +- test/e2e/test_catalogue_item.py | 12 +- test/e2e/test_item.py | 491 +++++++++------------------- test/mock_data.py | 8 + 4 files changed, 180 insertions(+), 344 deletions(-) diff --git a/test/e2e/test_catalogue_category.py b/test/e2e/test_catalogue_category.py index 73d2182b..52968b3b 100644 --- a/test/e2e/test_catalogue_category.py +++ b/test/e2e/test_catalogue_category.py @@ -24,9 +24,7 @@ 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 @@ -34,7 +32,8 @@ 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: @@ -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 diff --git a/test/e2e/test_catalogue_item.py b/test/e2e/test_catalogue_item.py index 9f648cf4..4a4a5d10 100644 --- a/test/e2e/test_catalogue_item.py +++ b/test/e2e/test_catalogue_item.py @@ -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 ) @@ -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 diff --git a/test/e2e/test_item.py b/test/e2e/test_item.py index 3354ecef..1b7c8ff9 100644 --- a/test/e2e/test_item.py +++ b/test/e2e/test_item.py @@ -2,6 +2,12 @@ """ End-to-End tests for the catalogue item router. """ + +# Expect some duplicate code inside tests as the tests for the different entities can be very similar +# pylint: disable=duplicate-code +# pylint: disable=too-many-public-methods +# pylint: disable=too-many-ancestors + from test.conftest import add_ids_to_properties from test.e2e.conftest import E2ETestHelpers, replace_unit_values_with_ids_in_properties from test.e2e.mock_schemas import ( @@ -33,8 +39,10 @@ PROPERTY_DATA_BOOLEAN_MANDATORY_FALSE, PROPERTY_DATA_NUMBER_NON_MANDATORY_WITH_MM_UNIT_1, PROPERTY_DATA_STRING_MANDATORY_TEXT, + SYSTEM_POST_DATA_ALL_VALUES_NO_PARENT, SYSTEM_POST_DATA_REQUIRED_VALUES_ONLY, USAGE_STATUS_DATA_IN_USE, + USAGE_STATUS_DATA_NEW, ) from typing import Any, Optional from unittest.mock import ANY @@ -122,14 +130,16 @@ def add_usage_status_value_and_id(self, usage_status_value: str, usage_status_id self.usage_status_value_id_dict[usage_status_value] = usage_status_id - def post_usage_status(self, usage_status_post_data: dict) -> None: + def post_usage_status(self, usage_status_post_data: dict) -> str: """Posts a usage status 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`. """ post_response = self.test_client.post("/v1/usage-statuses", json=usage_status_post_data) + usage_status_id = post_response.json()["id"] self.add_usage_status_value_and_id(usage_status_post_data["value"], post_response.json()["id"]) + return usage_status_id def post_item(self, item_data: dict) -> Optional[str]: """ @@ -754,11 +764,157 @@ def test_list_with_system_id_and_catalogue_item_id_filters_with_no_matching_resu self.check_get_items_success([]) -# TODO: Update tests +class UpdateDSL(ListDSL): + """Base class for update tests.""" + + _patch_response_item: Response + + def patch_item(self, item_id: str, item_update_data: dict) -> None: + """ + Updates an item with the given ID. + + :param item_id: ID of the item to patch. + :param item_update_data: Dictionary containing the basic patch data as would be required for a `ItemPatchSchema` + but with any `id`'s replaced by the `name` value in its properties as the IDs will be + added automatically. + """ + + # Replace any property names with ids + item_update_data = E2ETestHelpers.replace_property_names_with_ids_in_properties( + item_update_data, self.property_name_id_dict + ) + + self._patch_response_item = self.test_client.patch(f"/v1/items/{item_id}", json=item_update_data) + + def check_patch_item_response_success(self, expected_item_get_data: dict) -> None: + """ + Checks that a prior call to `patch_item` gave a successful response with the expected data + returned. + + :param expected_item_get_data: Dictionary containing the expected item data returned as would + be required for a `ItemSchema`. Does not need mandatory IDs + (e.g. `system_id`) as they will be added automatically to check + they are as expected. + """ + + assert self._patch_response_item.status_code == 200 + assert self._patch_response_item.json() == self.add_ids_to_expected_item_get_data(expected_item_get_data) + + E2ETestHelpers.check_created_and_modified_times_updated_correctly( + self._post_response_item, self._patch_response_item + ) + + def check_patch_item_failed_with_detail(self, status_code: int, detail: str) -> None: + """ + Checks that a prior call to `patch_item` gave a failed response with the expected code and error message. + + :param status_code: Expected status code of the response. + :param detail: Expected detail given in the response. + """ + + assert self._patch_response_item.status_code == status_code + assert self._patch_response_item.json()["detail"] == detail + + def check_patch_item_failed_with_validation_message(self, status_code: int, message: str) -> None: + """ + Checks that a prior call to `patch_item` gave a failed response with the expected code and pydantic validation + error message. + + :param status_code: Expected status code of the response. + :param message: Expected validation error message given in the response. + """ + + assert self._patch_response_item.status_code == status_code + assert self._patch_response_item.json()["detail"][0]["msg"] == message + + +class TestUpdate(UpdateDSL): + """Tests for updating an item.""" + + def test_partial_update_all_fields_except_ids_or_properties(self): + """Test updating all fields of an item except its any of its `_id` fields or properties.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, ITEM_DATA_ALL_VALUES_NO_PROPERTIES) + self.check_patch_item_response_success(ITEM_GET_DATA_ALL_VALUES_NO_PROPERTIES) + + def test_partial_update_catalogue_item_id(self): + """Test updating the `catalogue_item_id` of an item.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, {"catalogue_item_id": str(ObjectId())}) + self.check_patch_item_failed_with_detail(422, "Cannot change the catalogue item of an item") + + def test_partial_update_system_id(self): + """Test updating the `system_id` of an item.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + new_system_id = self.post_system(SYSTEM_POST_DATA_ALL_VALUES_NO_PARENT) + self.patch_item(item_id, {"system_id": new_system_id}) + self.check_patch_item_response_success(ITEM_GET_DATA_REQUIRED_VALUES_ONLY) -# TODO: Change this to UpdateDSL once done -class DeleteDSL(ListDSL): + def test_partial_update_system_id_with_non_existent_id(self): + """Test updating the `system_id` of an item to a non-existent system.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, {"system_id": str(ObjectId())}) + self.check_patch_item_failed_with_detail(422, "The specified system does not exist") + + def test_partial_update_system_id_with_invalid_id(self): + """Test updating the `system_id` of an item to an invalid ID.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, {"system_id": "invalid-id"}) + self.check_patch_item_failed_with_detail(422, "The specified system does not exist") + + def test_partial_update_usage_status_id(self): + """Test updating the `usage_status_id` of an item.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + new_usage_status_id = self.post_usage_status(USAGE_STATUS_DATA_NEW) + + self.patch_item(item_id, {"usage_status_id": new_usage_status_id}) + self.check_patch_item_response_success( + {**ITEM_GET_DATA_REQUIRED_VALUES_ONLY, "usage_status": USAGE_STATUS_DATA_NEW["value"]} + ) + + def test_partial_update_usage_status_id_with_non_existent_id(self): + """Test updating the `usage_status_id` of an item to a non-existent system.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, {"usage_status_id": str(ObjectId())}) + self.check_patch_item_failed_with_detail(422, "The specified usage status does not exist") + + def test_partial_update_usage_status_id_with_invalid_id(self): + """Test updating the `usage_status_id` of an item to an invalid ID.""" + + item_id = self.post_item_and_prerequisites_no_properties(ITEM_DATA_REQUIRED_VALUES_ONLY) + + self.patch_item(item_id, {"usage_status_id": "invalid-id"}) + self.check_patch_item_failed_with_detail(422, "The specified usage status does not exist") + + # TODO: More update tests + + def test_partial_update_with_non_existent_id(self): + """Test updating a non-existent item.""" + + self.patch_item(str(ObjectId()), {}) + self.check_patch_item_failed_with_detail(404, "Item not found") + + def test_partial_update_invalid_id(self): + """Test updating an item with an invalid ID.""" + + self.patch_item("invalid-id", {}) + self.check_patch_item_failed_with_detail(404, "Item not found") + + +class DeleteDSL(UpdateDSL): """Base class for delete tests.""" _delete_response_item: Response @@ -791,7 +947,6 @@ def check_delete_item_failed_with_detail(self, status_code: int, detail: str) -> assert self._delete_response_item.json()["detail"] == detail -# pylint:disable=too-many-ancestors class TestDelete(DeleteDSL): """Tests for deleting an item.""" @@ -924,332 +1079,6 @@ def test_delete_with_invalid_id(self): # # pylint: enable=duplicate-code -# def test_partial_update_item(test_client): -# """ -# Test changing 'usage_status' and 'is_defective' in an item -# """ - -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"usage_status": "Used", "is_defective": True} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 200 - -# item = response.json() - -# assert item == { -# **ITEM_POST_EXPECTED, -# **item_patch, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "usage_status": "New", -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# ITEM_POST_EXPECTED["properties"], -# ), -# } - - -# def test_partial_update_item_invalid_id(test_client): -# """ -# Test updating an item with an invalid ID. -# """ - -# item_patch = {"usage_status_id": str(ObjectId()), "is_defective": True} - -# response = test_client.patch("/v1/items/invalid", json=item_patch) - -# assert response.status_code == 404 -# assert response.json()["detail"] == "Item not found" - - -# def test_partial_update_item_non_existent_id(test_client): -# """ -# Test updating an item with a non-existent ID. -# """ -# item_patch = {"usage_status_id": str(ObjectId()), "is_defective": True} - -# response = test_client.patch(f"/v1/items/{str(ObjectId())}", json=item_patch) - -# assert response.status_code == 404 -# assert response.json()["detail"] == "Item not found" - - -# def test_partial_update_change_catalogue_item_id(test_client): -# """ -# Test moving an item to another catalogue item -# """ - -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] - -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"catalogue_item_id": str(ObjectId())} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 422 -# assert response.json()["detail"] == "Cannot change the catalogue item of an item" - - -# def test_partial_update_change_system_id(test_client): -# """ -# Test changing the system ID of an item -# """ -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id_a = response.json()["id"] - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_B) -# system_id_b = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id_a, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"system_id": system_id_b} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 200 - -# item = response.json() - -# assert item == { -# **ITEM_POST_EXPECTED, -# **item_patch, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id_b, -# "usage_status_id": usage_status_id, -# "usage_status": "New", -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# ITEM_POST_EXPECTED["properties"], -# ), -# } - - -# def test_partial_update_change_non_existent_system_id(test_client): -# """ -# Test updating system ID which is non-existent -# """ -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] - -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"system_id": str(ObjectId())} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 422 -# assert response.json()["detail"] == "The specified system does not exist" - - -# def test_partial_update_change_non_existent_usage_status_id(test_client): -# """ -# Test updating usage status ID which is non-existent -# """ -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] - -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"usage_status_id": str(ObjectId())} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 422 -# assert response.json()["detail"] == "The specified usage status does not exist" - - -# def test_partial_update_change_invalid_usage_status_id(test_client): -# """ -# Test updating usage status ID which is invalid -# """ -# catalogue_category = _post_catalogue_category_with_units(test_client, CATALOGUE_CATEGORY_POST_A) - -# response = test_client.post("/v1/systems", json=SYSTEM_POST_A) -# system_id = response.json()["id"] - -# response = test_client.post("/v1/manufacturers", json=MANUFACTURER_POST) -# manufacturer_id = response.json()["id"] - -# # pylint: disable=duplicate-code -# catalogue_item_post = { -# **CATALOGUE_ITEM_POST_A, -# "catalogue_category_id": catalogue_category["id"], -# "manufacturer_id": manufacturer_id, -# "properties": add_ids_to_properties( -# catalogue_category["properties"], -# CATALOGUE_ITEM_POST_A["properties"], -# ), -# } -# response = test_client.post("/v1/catalogue-items", json=catalogue_item_post) -# catalogue_item_id = response.json()["id"] - -# response = test_client.post("/v1/usage-statuses", json=USAGE_STATUS_POST_A) -# usage_status_id = response.json()["id"] - -# # pylint: enable=duplicate-code -# item_post = { -# **ITEM_POST, -# "catalogue_item_id": catalogue_item_id, -# "system_id": system_id, -# "usage_status_id": usage_status_id, -# "properties": add_ids_to_properties(catalogue_category["properties"], ITEM_POST["properties"]), -# } -# response = test_client.post("/v1/items", json=item_post) - -# item_patch = {"usage_status_id": "invalid"} -# response = test_client.patch(f"/v1/items/{response.json()['id']}", json=item_patch) - -# assert response.status_code == 422 -# assert response.json()["detail"] == "The specified usage status does not exist" - - # def test_partial_update_property_values(test_client): # """ # Test updating property values diff --git a/test/mock_data.py b/test/mock_data.py index 2d26cc0c..3d2c1483 100644 --- a/test/mock_data.py +++ b/test/mock_data.py @@ -30,6 +30,14 @@ # --------------------------------- USAGE STATUSES --------------------------------- +# New + +USAGE_STATUS_DATA_NEW = {"value": "New"} + +USAGE_STATUS_IN_DATA_NEW = {**USAGE_STATUS_DATA_NEW, "code": "new"} + +# In Use + USAGE_STATUS_DATA_IN_USE = {"value": "In Use"} USAGE_STATUS_IN_DATA_IN_USE = {**USAGE_STATUS_DATA_IN_USE, "code": "in-use"}