From 9026f675f4d64459d2c881e171cc40e69b795931 Mon Sep 17 00:00:00 2001 From: jberends Date: Tue, 26 Nov 2024 13:38:55 +0100 Subject: [PATCH] Add prefilter option to context reference property (#1468) * Add prefilter option to context reference property Implemented a method to set prefilters on the context reference property and created a new ContextgroupFilter class. Updated relevant imports and code sections to support this functionality. * Fix indentation in value_filter.py Correct the indentation of property type checks to enhance code readability and maintain consistency. This change ensures proper alignment and structure in the conditional statements. * Add prefilters to ContextReferencesProperty Implemented `set_prefilters` method in `ContextReferencesProperty` to support clearing and setting the `context_group` prefilter. Added corresponding unit tests to ensure proper functionality and to handle edge cases, including invalid inputs. * Remove unnecessary f-string in error message Refactor the exception raise to eliminate the unnecessary f-string formatting since no variables are being interpolated. This cleanup simplifies the code and ensures better readability. * Remove ContextGroup filtering and fix typos Deleted the ContextGroupFilter class including its methods and references to the ContextGroup enum. Corrected typos in comments for clarity. * Fix indentation in property type filtration Adjusted indentation to ensure that property types in the filter are correctly and clearly aligned. This enhances readability and maintains consistency in the code formatting structure. * Refactor docstring to improve clarity Simplified the docstring of `parse_options` method for better readability. Changed the description to be more concise and removed unnecessary line breaks. * Remove unused import in test_properties.py Removed the import of `ContextType` and `ContextReferencesProperty` from `test_properties.py` as they were unused. This change reduces unnecessary code clutter and improves maintainability of the test suite. --------- Co-authored-by: Jochem Berends --- CHANGELOG.rst | 7 ++- pykechain/models/property_reference.py | 34 ++++++++++++ pykechain/models/value_filter.py | 31 ++++++----- pykechain/models/widgets/helpers.py | 1 + ...filters.test_set_prefilters_no_params.json | 1 + ...ilters.test_set_prefilters_with_clear.json | 1 + ...prefilters_with_invalid_context_group.json | 1 + ...s.test_set_prefilters_with_prefilters.json | 1 + ...t_prefilters_with_valid_context_group.json | 1 + tests/test_properties.py | 53 +++++++++++++++++++ 10 files changed, 117 insertions(+), 14 deletions(-) create mode 100644 tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_no_params.json create mode 100644 tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_clear.json create mode 100644 tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_invalid_context_group.json create mode 100644 tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_prefilters.json create mode 100644 tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_valid_context_group.json diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 110d3bd81..9f16cd042 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,8 +1,12 @@ Change Log ========== -v4.15.0 (14NOV24) +UNRELEASED ---------- +* :star: Add the possibility to add a prefilter option to the context reference property. It will be stored in the prefilter section of the value options of a the reference property. + +v4.15.0 (14NOV24) +----------------- * :star: We added a `json_load()` method on the `StoredFile` to be compatible with the same interface as the attachment property. (#1485) v4.14.0 (20SEP24) @@ -34,7 +38,6 @@ v4.10.0 (5MAR24) * :+1: Added python tests for 3.12. (#1389) * :+1: dependent versions for development: tox (4.12.1), flake8 (7.0.0), jsonschema (4.21.1), importlib-metadata (7.0.1), mypy (1.8.0), pytest (8.1.0), coverage (7.4.3), pre-commit (3.6.2), pytz (2024.1), pytest-xdist (3.5.0), semver (3.0.2), Pillow (10.2.0) - v4.9.0 (28SEP23) ---------------- * :+1: Changed the way we download pdf's from activity where we now provide the `timezone` query param in the request URL with timezone info for a more accurate determination of the display of time information in the pdf taking into account the timezone and timesystem info. For compatability sake we maintain the `offset` query param in the request to support older KE-chain backend versions. diff --git a/pykechain/models/property_reference.py b/pykechain/models/property_reference.py index 1a2dfd84c..5d4684fe1 100644 --- a/pykechain/models/property_reference.py +++ b/pykechain/models/property_reference.py @@ -3,6 +3,7 @@ from pykechain.defaults import PARTS_BATCH_LIMIT from pykechain.enums import ( + ContextGroup, ScopeReferenceColumns, StoredFileCategory, StoredFileClassification, @@ -15,6 +16,7 @@ ) from pykechain.models.context import Context from pykechain.models.form import Form +from pykechain.models.input_checks import check_enum from pykechain.models.stored_file import StoredFile from pykechain.models.value_filter import ScopeFilter from pykechain.models.workflow import Status @@ -226,6 +228,38 @@ class ContextReferencesProperty(_ReferencePropertyInScope): REFERENCED_CLASS = Context + def set_prefilters( + self, + prefilters: Optional = None, + clear: Optional[bool] = False, + context_group: Optional[ContextGroup] = None, + ) -> None: + """ + Set pre-filters on the Context reference property. + + On the Context only a context_group prefilter can be set to a single ContextGroup. + + :param prefilters: Not used + :param clear: whether all existing pre-filters should be cleared. (default = False) + :param context_group: An optional ContextGroup to prefilter on. One single prefilter is + allowed. + + :return: None + """ + prefilters_dict = self._options.get("prefilters", dict()) + if prefilters: + raise IllegalArgumentError( + "`prefilters` argument is unused. Use `context_group` instead." + ) + if clear: + prefilters_dict = dict() + if context_group: + context_group = check_enum(context_group, ContextGroup, "context_group") + prefilters_dict = {"context_group": context_group} + + if context_group or clear: + self._options.update({"prefilters": prefilters_dict}) + def _retrieve_objects(self, **kwargs) -> List[Context]: """ Retrieve a list of Contexts. diff --git a/pykechain/models/value_filter.py b/pykechain/models/value_filter.py index e7f781515..bb9c391db 100644 --- a/pykechain/models/value_filter.py +++ b/pykechain/models/value_filter.py @@ -3,8 +3,14 @@ import warnings from abc import abstractmethod from typing import Any, Dict, List, Optional, Union +from urllib.parse import unquote -from pykechain.enums import Category, FilterType, PropertyType, ScopeStatus +from pykechain.enums import ( + Category, + FilterType, + PropertyType, + ScopeStatus, +) from pykechain.exceptions import IllegalArgumentError, NotFoundError from pykechain.models.input_checks import ( check_base, @@ -75,7 +81,7 @@ def __init__( self.id = property_model_id if isinstance(value, str): - self.value = urllib.parse.unquote(value) + self.value = unquote(value) else: self.value = value self.type = filter_type @@ -113,9 +119,7 @@ def validate(self, part_model: "Part") -> None: if prop.category != Category.MODEL: raise IllegalArgumentError( - 'Property value filters can only be set on Property models, received "{}".'.format( - prop - ) + f'Property value filters can only be set on Property models, received "{prop}".' ) else: property_type = prop.type @@ -190,9 +194,10 @@ def validate(self, part_model: "Part") -> None: @classmethod def parse_options(cls, options: Dict) -> List["PropertyValueFilter"]: """ - Convert the dict & string-based definition of a property value filter to a list of PropertyValueFilter objects. + Convert dict and string filters to PropertyValueFilter objects. - :param options: options dict from a multi-reference property or meta dict from a filtered grid widget. + :param options: options dict from a multi-reference property or meta dict from a filtered + grid widget. :return: list of PropertyValueFilter objects :rtype list """ @@ -235,7 +240,8 @@ class ScopeFilter(BaseFilter): :ivar tag: string """ - # map between KE-chain field and Pykechain attribute, and whether the filter is stored as a list (cs-string) + # map between KE-chain field and Pykechain attribute, and whether the filter is stored as a + # list (cs-string) MAP = [ ("name__icontains", "name", False), ("status__in", "status", False), @@ -325,9 +331,10 @@ def __repr__(self): @classmethod def parse_options(cls, options: Dict) -> List["ScopeFilter"]: """ - Convert the dict & string-based definition of a scope filter to a list of ScopeFilter objects. + Convert the dict & string-based definition of a scope filter to a list of ScopeFilter obj. - :param options: options dict from a scope reference property or meta dict from a scopes widget. + :param options: options dict from a scope reference property or meta dict from a scopes + widget. :return: list of ScopeFilter objects :rtype list """ @@ -377,8 +384,8 @@ def write_options(cls, filters: List) -> Dict: if filter_value is not None: if is_list: - # creata a string with commaseparted prefilters, the first item directly and - # consequent items with a , + # create a string with comma separted prefilters, the first item directly + # and consequent items with a , # TODO: refactor to create a list and then join them with a ',' if field not in prefilters: prefilters[field] = filter_value diff --git a/pykechain/models/widgets/helpers.py b/pykechain/models/widgets/helpers.py index fd48f829c..cd30a6e01 100644 --- a/pykechain/models/widgets/helpers.py +++ b/pykechain/models/widgets/helpers.py @@ -412,6 +412,7 @@ def _check_prefilters( :raises IllegalArgumentError: when the type of the input is provided incorrect. """ if isinstance(prefilters, dict): + from pykechain.models import Property property_models: List[Property, str] = prefilters.get( MetaWidget.PROPERTY_MODELS, [] ) # noqa diff --git a/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_no_params.json b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_no_params.json new file mode 100644 index 000000000..bf60d89b4 --- /dev/null +++ b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_no_params.json @@ -0,0 +1 @@ +{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VVwW7kNgz9FcPXRoEky7I9p20Xe9hD26DJ7qFFMKBleqLGtgxZnt1BMP9eypNMPEi37WF7MGBS5OMjKT8/pcbNQ0g34iod8Cu9DHPXXaWjx7118/Rie5zmLpD5x1Nqm3ST1k3eGARgkOXIVFFzVrUmZ2WRK8FbBbluU8KEHin6J/uIyY13f6IJaURrIwQ52Xh2hqV8+hyVzBM2SXBJwCkkN4dHNA9ghwSGJhnn6SGxYTl9wKSzvSVqV+kUIETK6Y/v7z5+/kAeAwF3zh/I9+n2w2/b2/e/3ix+j3TSbCFWlFxUTHAm5R0vN1xvVHldFirP8t8pdB6bdajMGM+YyO+E2uTlRqlrzrmueAwNsIsTWhoj8yubjBuRBfA7DOk9EYz21o3BuoEin1K3R+9tg7f01ODTTQvdhHFAtIAJB2roFEpj9+EwxlmaeQqu/2jcEBtxQ2t3Eaqx09jBYfHH2ZqD6SKLlf9n10QAj7u5o2LHI1E6of0Ce7tbalGp+2NcBvRb22xP+zvdgR77Gv3rHZClpvFM6J+XPM0j+r2dnH9dPL3ZaQsm2D2Zwc/UHPZgu/PZCfXcefTAALtL1wr6GYScHUJzkX28OhHLLmjFC/QC+X14nRmsab3GfZOXesMrmq+kPpGV3JH7n9jBu/p66C45ngn9y+j+A8fq7fBi7P+60b+nFaFfWIm3F+1ydLcr1zfpPbh4E6aA/ofR9hmLzb0jDVqU5dq4/vvzv49Sugja1g6ti1/XolM+bKOsvHxazYwXNuXsSADO8vvF+ce2c1+23jlCigLMBW+05oqp3NRMlUaxUuUF01mb81JqUGV7UkDo3G6V2LSoSKk5U5WWTLUVsEqVghVYywZKUSgJlAjjuErKashKhYrJohCUxDkDqsJqWbZC51nDpU4X3s1MvfakNN0psypLVQmpmKhUxZQm9awQJBOqqlQNpKgcVpl2oOkMBk/JoHmRoapZXgmgTkVGFYv4qwEtoJaQmWzV5KpsrbVQJhdM5jllSqxYmcmSKSF1gSJroChWmZdlK07AWAmGpdCUwoHVhggIrelnoXJoZZYe749/ASxW3Ws+BwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:46 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "recorded_at": "2024-09-16T08:55:44"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA82WbW/iOBDHvwrK6xr5MXZ4h1q6V6kPp5bu6XqqkOOHxSokXHB6i6p+950AKbTlFlbVnfoqmfHYM/bvn4mfElPWRUx65Cgp3Hd4KerJ5CiZVe4xlPW8tSs3rycRzL+ekmCTXuIwEZI5ixTDCnFBMNLUW8RTbpixFmusElhTTx1E/zF2bpI0y3iw/llb1s1NFWYxlAV4wWF0dN/KagHWxdXJ4LxxTfR8HnyAoVXY79dXJ7fHQxiaQkVhNgkmxGbG3eD6anTRv/yzmVU5WMqONGwooZhkCOqjdIhVD6c9nnWVyKSSdxBaz+zeUIVJEzo35cyNltvPrbDGaY00Ew5xmWOUeSOQkoIT7LkWqYcZM125Iq6mOK4xlzpF8MSIE3jLteNIMqoN9SnLrGt2VVo3Wc5oSUDSKga3dfgpc4IqkyGrjESc5wTlubUoAyCO5JJqzDaHfxLgGV31cv5243iHYJ1uMYqLWTP59PyqPxx97Z/fDn4ZUFlZSNLDcMhFeJHWo57UblQuc8Kenp7XrqTHGe2SQ+BJznG6Ax6lCMRI8JDQHpU9gbsyk1LRuxWKFsRh0v112m/RlXWc1VBZrGr3fLRmBxMUZh4UoLIc2DGHtNIGcccp9blMNd9idzMrH4B8S27emnu5nV1+kBo5lBo+hFgmeUoOJpZ9KmLWu5wK6VGaYyCmrUFZCgBTq2RqqeeGiA2x6zDtXMAWq6A3Ha8KUzTdOPfSO/6tf/0xfPRQfEnf6qkuYqinhzTOjBLOxeEk089EMlPSZZrkUCaFtbBVSDnGEfGe2YwInRm7ITkMlesMx8E8FG6++QYjuFHccv8fPZQdinM1vh8jTzHe9UHuCBWYyk+FkROpUsUVyhmGtawWKHfQR73PmU2xgj8g32A8bi441aJT+g7ovPbaxLpyLzjNahiVHr0e3ov15uzyy/lgdDM4Hxx/EC//Od7GEQBTWa0uAY/rCir3dw1qtKfBTezXNqbJWBY+fGuE8XzfLmfGZTDLW0RyC7mc7dxEqLVR8GmlC9Ps+Yur4BAW8HYW9WSR3DenBHfBOdxi9LoayF+t8+d1jGVx/SpiO/vuADjzsTMPefkdkkOBe8TbNBaBcLpsLLQnWJdJIVL6Lz3oTahiXKrPJF4hNQOB5ijHxiPevGmNLYIfjGeUZ9oxvS3eWQBSrfQ6oZjHNatWvk0AagPQVsBrAW9ZzacQx+5l1f/i+iBaRS8fOzL+5BpI32uAI5wtfy6sJ4Bt2hVMEpHt0sD7UC6Z+hQN7P6t/fwDDTJq2YANAAA=", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:46 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:44"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA92ZWW8jNxKA/0ogYPdpaBVvUoARaGzNgfgY2JqMdxaBwKNo90aWtOpW4snA/31Lsg4ncWINZGANP6jVLF7F+opFlvS1lcazUdPq8FetEd7Qy2g2HL5qTab4SzWe1avyFOvZsKHiv7+2qtzqtFAFUDYYRt/AFKe3GFAxK0VIohjpM7ZozHCN1Pp19fO8NMVChXhXyFinaTVpqvGIhCRIocHL8fQLlY5PD3tHc9Ew1HVVKqq6a/bh7PTw40Gfqq5Jn2oyrFLVzHt87p2dDo67J/+a95oiDZUHgZbTEsA948CE6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JYPOLmCZGBYczW7jqNQDZmgi+3N/MEs7P1ncvn9Bete/8a6QzJO1Vxd73c/nSv27rh7wM7fdYU2/7xrcEB6E5YqDPcPTwF+fG37F5+sOnn7w8HFsTv4h3gznxc8N/Q6txJ9LR7h11oNpvjfGVliOdacz/6qOe0qrZX5vKxbHOhY7xuApeScVob5HQZyoHr/arwe5ny15H0dQklZFqeTSZhUkrpwG42jRNLRvk6QCpi5PXVWGko2dOmRHgwGkFzP49mLgsyp9mb+eEmQKYJBtDJYMILOJqsUAoU4yraL1Zzr5CAnTtw9Bw2G6FvjNUZByVtQQRLki/OXRRkIMrwoxgGNFpmsk4tOOtKASBaN3GJBA95B9M560EGGoJVSTgstk7MSsxYLxscvCbFRcEOf54XY7oSYoIGXaFzB4DBFQFdMxmyLS4obHUsKnDJYIT1lPwCe9q4VhSurvIw4zxkK3R0WkHZF/X8C/CI4Ck43TdTknVJFIQOnw7TIbFAhzxSRCaxKkbhFCsMmUDguBqJ2vJiYChfE8UVFYynghj4vaatKblKOItCVCZxyKWhNzJVQJcfiMhoRrUiZe1dUpC0rEzplJAdXCqDhLbqA3/2ms4Whf5ed/LXFVynUN/w3s8pkVinU7Z+SwdUsffAdxTtS7kkKRU4+9B/E/aayA3bPCK+ceA7J4E9/LN/+D4xfwmj1GwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:47 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:45"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"__Test context ref property @ 2024-09-16 10:55:45.033141\", \"part_id\": \"e4a047a6-4a00-41a6-bae4-732ac2f639de\", \"description\": \"Description of test ref property\", \"property_type\": \"CONTEXT_REFERENCES_VALUE\", \"value\": null, \"unit\": \"no unit\", \"value_options\": {}}"}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["270"], "Content-Type": ["application/json"]}, "method": "POST", "uri": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "response": {"body": {"encoding": "utf-8", "string": "{\"results\":[{\"id\":\"8399377c-c344-46b5-9e19-2ad7d78adf88\",\"name\":\"__Test context ref property @ 2024-09-16 10:55:45.033141\",\"ref\":\"test-context-ref-property-2024-09-16-105545033141\",\"description\":\"Description of test ref property\",\"property_type\":\"CONTEXT_REFERENCES_VALUE\",\"category\":\"MODEL\",\"order\":8,\"unit\":\"no unit\",\"value_options\":{},\"value\":[],\"created_at\":\"2024-09-16T08:55:47.250621Z\",\"updated_at\":\"2024-09-16T08:55:47.262915Z\",\"part_id\":\"e4a047a6-4a00-41a6-bae4-732ac2f639de\",\"scope_id\":\"bd5dceaa-a35e-47b0-9fc5-875410f4a56f\",\"model_id\":null,\"output\":true}]}"}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:47 GMT"], "Content-Type": ["application/json"], "Content-Length": ["566"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["POST, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 201, "message": "Created"}, "url": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "recorded_at": "2024-09-16T08:55:45"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["0"]}, "method": "DELETE", "uri": "/api/v3/properties/8399377c-c344-46b5-9e19-2ad7d78adf88.json"}, "response": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:48 GMT"], "Content-Type": ["application/json"], "Content-Length": ["14"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["GET, PUT, PATCH, DELETE, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 204, "message": "No Content"}, "url": "/api/v3/properties/8399377c-c344-46b5-9e19-2ad7d78adf88.json"}, "recorded_at": "2024-09-16T08:55:46"}], "recorded_with": "betamax/0.9.0"} \ No newline at end of file diff --git a/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_clear.json b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_clear.json new file mode 100644 index 000000000..c740a14ea --- /dev/null +++ b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_clear.json @@ -0,0 +1 @@ +{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VVwW7kNgz9FcPXRoEky7I9p20Xe9hD26DJ7qFFMKBleqLGtgxZnt1BMP9eypNMPEi37WF7MGBS5OMjKT8/pcbNQ0g34iod8Cu9DHPXXaWjx7118/Rie5zmLpD5x1Nqm3ST1k3eGARgkOXIVFFzVrUmZ2WRK8FbBbluU8KEHin6J/uIyY13f6IJaURrIwQ52Xh2hqV8+hyVzBM2SXBJwCkkN4dHNA9ghwSGJhnn6SGxYTl9wKSzvSVqV+kUIETK6Y/v7z5+/kAeAwF3zh/I9+n2w2/b2/e/3ix+j3TSbCFWlFxUTHAm5R0vN1xvVHldFirP8t8pdB6bdajMGM+YyO+E2uTlRqlrzrmueAwNsIsTWhoj8yubjBuRBfA7DOk9EYz21o3BuoEin1K3R+9tg7f01ODTTQvdhHFAtIAJB2roFEpj9+EwxlmaeQqu/2jcEBtxQ2t3Eaqx09jBYfHH2ZqD6SKLlf9n10QAj7u5o2LHI1E6of0Ce7tbalGp+2NcBvRb22xP+zvdgR77Gv3rHZClpvFM6J+XPM0j+r2dnH9dPL3ZaQsm2D2Zwc/UHPZgu/PZCfXcefTAALtL1wr6GYScHUJzkX28OhHLLmjFC/QC+X14nRmsab3GfZOXesMrmq+kPpGV3JH7n9jBu/p66C45ngn9y+j+A8fq7fBi7P+60b+nFaFfWIm3F+1ydLcr1zfpPbh4E6aA/ofR9hmLzb0jDVqU5dq4/vvzv49Sugja1g6ti1/XolM+bKOsvHxazYwXNuXsSADO8vvF+ce2c1+23jlCigLMBW+05oqp3NRMlUaxUuUF01mb81JqUGV7UkDo3G6V2LSoSKk5U5WWTLUVsEqVghVYywZKUSgJlAjjuErKashKhYrJohCUxDkDqsJqWbZC51nDpU4X3s1MvfakNN0psypLVQmpmKhUxZQm9awQJBOqqlQNpKgcVpl2oOkMBk/JoHmRoapZXgmgTkVGFYv4qwEtoJaQmWzV5KpsrbVQJhdM5jllSqxYmcmSKSF1gSJroChWmZdlK07AWAmGpdCUwoHVhggIrelnoXJoZZYe749/ASxW3Ws+BwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:48 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "recorded_at": "2024-09-16T08:55:46"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA82WbW/iOBDHvwrK6xr5MXZ4h1q6V6kPp5bu6XqqkOOHxSokXHB6i6p+950AKbTlFlbVnfoqmfHYM/bvn4mfElPWRUx65Cgp3Hd4KerJ5CiZVe4xlPW8tSs3rycRzL+ekmCTXuIwEZI5ixTDCnFBMNLUW8RTbpixFmusElhTTx1E/zF2bpI0y3iw/llb1s1NFWYxlAV4wWF0dN/KagHWxdXJ4LxxTfR8HnyAoVXY79dXJ7fHQxiaQkVhNgkmxGbG3eD6anTRv/yzmVU5WMqONGwooZhkCOqj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Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:46"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA92ZWW8bNxCA/0ohoH0KLd6HAKNQbCUO6iOwlcZNEQg8hvY2urq7ap0a/u+dlXW4iVsrkIEaftBqOb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GxrqhPlohbmUX4gwFSoXKqCmY7+IreJknFFx7LGWdubL647TfnPq39x8XG+B67vanvZe9U57x3u9/ftUPts7eTuvycVw3vP8EKWXdT2tOu22H1ViJxUXBYboE4Q3rqY+QrUTJ6P2J4hkBKnwBI2X2tNiJEgNVd0eDKriL9xPg3ZVT0pIzchVuxpssgHaeRAZ94kxvAdpwoRSIuUA2hM8OWzKSQUZU3tlhgHmSZJQ3LNswHArCEI1qS9nozD2xZBwDGyvmgcxdOe36cWP56Q7+ot0h2icor4c7Xbfn0lycNTdI2cHXa70D7cN9lBvxFL44e7+CaU/vzT98/dGHr/+ae/8yO59z18181LHNL42VsKv+cP/WclBCb/P0BKLsRo+u8vm6FVKSfthUTe/0KHa1ZQuJGe4MkgH4HEDVbuXk9UwZ8sl7wovFeUefPZaxRRpVM4w9AcBDl2Pc56kjTk5TDYwjjCSiWyo8xwyZTFypP2sIDOsvWoeTwuy2wpyNF6GxAIi9gqz/pi4ME4bLR2zyFlym7VyjjMH1lkeuBcc22Xg3lArEPL52fOiTBEyfU6MwQqIDVPkRpWjXmoZqEaeMVkeeZBGcRMQfeYs2EQdj0FExpA0Falx5KPnhFhLeoWf54RYg6EgbLAYr+TAtUpA0VE1viTDlGYQMV4JVgRgTgYtMlCOOb3F6BPTP9XczBg7zCFti/p/AvwsOELiaBcprUhWRWcTT+imCU1gwWuJp3WUSgUF0mSXIaLXoiibqKxz0Ujk+KxOY8HpFX6ek6umDEkwJKjxMkX3k2AA710wJmMGrzTeqplKlbNKCik3CYgPFGwG0EZR3cIA/PY3nQ0M/Y/s5N8tvkyhvuG/mWUms0yhbr5KBpez9KnrSNYRYkdIpq247z+Iu01Fh5odzZ20/Ckkgx+/LN/8DbGIsPr1GwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:49 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:47"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"__Test context ref property @ 2024-09-16 10:55:47.078729\", \"part_id\": \"e4a047a6-4a00-41a6-bae4-732ac2f639de\", \"description\": \"Description of test ref property\", \"property_type\": \"CONTEXT_REFERENCES_VALUE\", \"value\": null, \"unit\": \"no unit\", \"value_options\": {}}"}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["270"], "Content-Type": ["application/json"]}, "method": "POST", "uri": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "response": {"body": {"encoding": "utf-8", "string": "{\"results\":[{\"id\":\"3781f936-7aa8-40e7-a24f-e014241d15ca\",\"name\":\"__Test context ref property @ 2024-09-16 10:55:47.078729\",\"ref\":\"test-context-ref-property-2024-09-16-105547078729\",\"description\":\"Description of test ref property\",\"property_type\":\"CONTEXT_REFERENCES_VALUE\",\"category\":\"MODEL\",\"order\":8,\"unit\":\"no unit\",\"value_options\":{},\"value\":[],\"created_at\":\"2024-09-16T08:55:49.294076Z\",\"updated_at\":\"2024-09-16T08:55:49.304622Z\",\"part_id\":\"e4a047a6-4a00-41a6-bae4-732ac2f639de\",\"scope_id\":\"bd5dceaa-a35e-47b0-9fc5-875410f4a56f\",\"model_id\":null,\"output\":true}]}"}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:49 GMT"], "Content-Type": ["application/json"], "Content-Length": ["566"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["POST, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 201, "message": "Created"}, "url": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "recorded_at": "2024-09-16T08:55:47"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["0"]}, "method": "DELETE", "uri": "/api/v3/properties/3781f936-7aa8-40e7-a24f-e014241d15ca.json"}, "response": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:49 GMT"], "Content-Type": ["application/json"], "Content-Length": ["14"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["GET, PUT, PATCH, DELETE, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 204, "message": "No Content"}, "url": "/api/v3/properties/3781f936-7aa8-40e7-a24f-e014241d15ca.json"}, "recorded_at": "2024-09-16T08:55:47"}], "recorded_with": "betamax/0.9.0"} \ No newline at end of file diff --git a/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_invalid_context_group.json b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_invalid_context_group.json new file mode 100644 index 000000000..98d3e290f --- /dev/null +++ b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_invalid_context_group.json @@ -0,0 +1 @@ +{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VVwW7kNgz9FcPXRoEky7I9p20Xe9hD26DJ7qFFMKBleqLG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sep 2024 08:55:50 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "recorded_at": "2024-09-16T08:55:48"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA82WbW/iOBDHvwrK6xr5MXZ4h1q6V6kPp5bu6Xq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LpsLLQnWJdJIVL6Lz3oTahiXKrPJF4hNQOB5ijHxiPevGmNLYIfjGeUZ9oxvS3eWQBSrfQ6oZjHNatWvk0AagPQVsBrAW9ZzacQx+5l1f/i+iBaRS8fOzL+5BpI32uAI5wtfy6sJ4Bt2hVMEpHt0sD7UC6Z+hQN7P6t/fwDDTJq2YANAAA=", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:50 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:48"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA92ZWW8jRRCA/wqyBE/bcfXdbSlC3sR7iByrxMuGRcjqoyYZ8IVnDFlW+e/UOD4CBOJVIhH5wePp6qu6vu7qKvtzK03m47rV4S9aY7yml/F8OHzRms7wt3Iyr1blGVbzYU3FHz+3ytzqtFAFUDYYRt/AFKe3GFAxK0VIojDSZ2zRmGGE1Ppl+UtTmmFBhXhbyFilWTmty8mYhCRIocbLyewTlY5PD3tHjWgYqqosSqq6bfbu7PTw/UGfqkakTzkdlqmsmx4fe2eng+PuyQ9NrxnSUHkQaDktAdwzDkyIPrgOmI7ye9w4Y9VHajqf5oebukXTKk2mOFgsPmadE4bAgtTIlI3AfJE0c1YrDoUK2hTUYxpmOK5vu3jnlOdCMe6VZ8qAZB6DYFx5r2IQICA0q5pkHC56rDjQpLO6xDump1kAIxQsmZiYKgKwEEXBrAPwBrjUutiY/jWGWbW2/eWy9A/jLyf6NKg/TZtub0/6g++7R+97XwxmMss4a3WAjDsu1xvqtzCc42CymJHW8vlmKVrVP8hMcOBK38NMAAOyo+hz0ZGuI2HPa69vmRGBpf233K9fDvnvxCbzejonzerZHG9eLJHxpEE7l5i0RSYVcmK0ITijzRWET6h9yhtk/Ukdhl9dYXl5Va/J1Y2QrYUPAnx1dNp9JEL+1AgVrXm7Yye0lOCfE8ICoZCgHBMYJVMoHfMxOuY4RxsCQbRxg/Bdmer5bOPzpuvyg+C6/X734M1x77EHUDw1Pae94tvR80CtnxM9V+SYuASGljumZM6Mjh5nySonpREK0WzoHd5htCKY/yJ7kGK/d/FIfvKJ+UmhuLNb8ZNETz4rB5rQWQMOmRemYCp5xWJEUjzbQPyUIPU2/HrX03JWji+/ata5JohLKVtKH2R42O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Xgt7/pbGHov2Qn/27xVQr1Bf/NrDKZVQp1849kcDVLH3xH8Y6Ue1Jx4+R9/0HcbSo7YPeM8MqJ55AM/vT38s2fJWPnk/UbAAA=", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:50 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:48"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"__Test context ref property @ 2024-09-16 10:55:48.819643\", \"part_id\": \"e4a047a6-4a00-41a6-bae4-732ac2f639de\", \"description\": \"Description of test ref property\", \"property_type\": \"CONTEXT_REFERENCES_VALUE\", \"value\": null, \"unit\": \"no unit\", \"value_options\": {}}"}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["270"], "Content-Type": ["application/json"]}, "method": "POST", "uri": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "response": {"body": {"encoding": "utf-8", "string": "{\"results\":[{\"id\":\"2e41e890-323c-4bb6-9f80-a0ae4e0f25d0\",\"name\":\"__Test context ref property @ 2024-09-16 10:55:48.819643\",\"ref\":\"test-context-ref-property-2024-09-16-105548819643\",\"description\":\"Description of test ref property\",\"property_type\":\"CONTEXT_REFERENCES_VALUE\",\"category\":\"MODEL\",\"order\":8,\"unit\":\"no unit\",\"value_options\":{},\"value\":[],\"created_at\":\"2024-09-16T08:55:51.035346Z\",\"updated_at\":\"2024-09-16T08:55:51.044670Z\",\"part_id\":\"e4a047a6-4a00-41a6-bae4-732ac2f639de\",\"scope_id\":\"bd5dceaa-a35e-47b0-9fc5-875410f4a56f\",\"model_id\":null,\"output\":true}]}"}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:51 GMT"], "Content-Type": ["application/json"], "Content-Length": ["566"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["POST, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 201, "message": "Created"}, "url": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "recorded_at": "2024-09-16T08:55:49"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["0"]}, "method": "DELETE", "uri": "/api/v3/properties/2e41e890-323c-4bb6-9f80-a0ae4e0f25d0.json"}, "response": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:51 GMT"], "Content-Type": ["application/json"], "Content-Length": ["14"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["GET, PUT, PATCH, DELETE, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 204, "message": "No Content"}, "url": "/api/v3/properties/2e41e890-323c-4bb6-9f80-a0ae4e0f25d0.json"}, "recorded_at": "2024-09-16T08:55:49"}], "recorded_with": "betamax/0.9.0"} \ No newline at end of file diff --git a/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_prefilters.json b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_prefilters.json new file mode 100644 index 000000000..8b70fefb6 --- /dev/null +++ b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_prefilters.json @@ -0,0 +1 @@ +{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VVwW7kNgz9FcPXRoEky7I9p20Xe9hD26DJ7qFFMKBleqLGtgxZnt1BMP9eypNMPEi37WF7MGBS5OMjKT8/pcbNQ0g34iod8Cu9DHPXXaWjx7118/Rie5zmLpD5x1Nqm3ST1k3eGARgkOXIVFFzVrUmZ2WRK8FbBbluU8KEHin6J/uIyY13f6IJaURrIwQ52Xh2hqV8+hyVzBM2SXBJwCkkN4dHNA9ghwSGJhnn6SGxYTl9wKSzvSVqV+kUIETK6Y/v7z5+/kAeAwF3zh/I9+n2w2/b2/e/3ix+j3TSbCFWlFxUTHAm5R0vN1xvVHldFirP8t8pdB6bdajMGM+YyO+E2uTlRqlrzrmueAwNsIsTWhoj8yubjBuRBfA7DOk9EYz21o3BuoEin1K3R+9tg7f01ODTTQvdhHFAtIAJB2roFEpj9+EwxlmaeQqu/2jcEBtxQ2t3Eaqx09jBYfHH2ZqD6SKLlf9n10QAj7u5o2LHI1E6of0Ce7tbalGp+2NcBvRb22xP+zvdgR77Gv3rHZClpvFM6J+XPM0j+r2dnH9dPL3ZaQsm2D2Zwc/UHPZgu/PZCfXcefTAALtL1wr6GYScHUJzkX28OhHLLmjFC/QC+X14nRmsab3GfZOXesMrmq+kPpGV3JH7n9jBu/p66C45ngn9y+j+A8fq7fBi7P+60b+nFaFfWIm3F+1ydLcr1zfpPbh4E6aA/ofR9hmLzb0jDVqU5dq4/vvzv49Sugja1g6ti1/XolM+bKOsvHxazYwXNuXsSADO8vvF+ce2c1+23jlCigLMBW+05oqp3NRMlUaxUuUF01mb81JqUGV7UkDo3G6V2LSoSKk5U5WWTLUVsEqVghVYywZKUSgJlAjjuErKashKhYrJohCUxDkDqsJqWbZC51nDpU4X3s1MvfakNN0psypLVQmpmKhUxZQm9awQJBOqqlQNpKgcVpl2oOkMBk/JoHmRoapZXgmgTkVGFYv4qwEtoJaQmWzV5KpsrbVQJhdM5jllSqxYmcmSKSF1gSJroChWmZdlK07AWAmGpdCUwoHVhggIrelnoXJoZZYe749/ASxW3Ws+BwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:51 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "recorded_at": "2024-09-16T08:55:49"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA82WbW/iOBDHvwrK6xr5MXZ4h1q6V6kPp5bu6XqqkOOHxSokXHB6i6p+950AKbTlFlbVnfoqmfHYM/bvn4mfElPWRUx65Cgp3Hd4KerJ5CiZVe4xlPW8tSs3rycRzL+ekmCTXuIwEZI5ixTDCnFBMNLUW8RTbpixFmusElhTTx1E/zF2bpI0y3iw/llb1s1NFWYxlAV4wWF0dN/KagHWxdXJ4LxxTfR8HnyAoVXY79dXJ7fHQxiaQkVhNgkmxGbG3eD6anTRv/yzmVU5WMqONGwooZhkCOqjdIhVD6c9nnWVyKSSdxBaz+zeUIVJEzo35cyNltvPrbDGaY00Ew5xmWOUeSOQkoIT7LkWqYcZM125Iq6mOK4xlzpF8MSIE3jLteNIMqoN9SnLrGt2VVo3Wc5oSUDSKga3dfgpc4IqkyGrjESc5wTlubUoAyCO5JJqzDaHfxLgGV31cv5243iHYJ1uMYqLWTP59PyqPxx97Z/fDn4ZUFlZSNLDcMhFeJHWo57UblQuc8Kenp7XrqTHGe2SQ+BJznG6Ax6lCMRI8JDQHpU9gbsyk1LRuxWKFsRh0v112m/RlXWc1VBZrGr3fLRmBxMUZh4UoLIc2DGHtNIGcccp9blMNd9idzMrH4B8S27emnu5nV1+kBo5lBo+hFgmeUoOJpZ9KmLWu5wK6VGaYyCmrUFZCgBTq2RqqeeGiA2x6zDtXMAWq6A3Ha8KUzTdOPfSO/6tf/0xfPRQfEnf6qkuYqinhzTOjBLOxeEk089EMlPSZZrkUCaFtbBVSDnGEfGe2YwInRm7ITkMlesMx8E8FG6++QYjuFHccv8fPZQdinM1vh8jTzHe9UHuCBWYyk+FkROpUsUVyhmGtawWKHfQR73PmU2xgj8g32A8bi441aJT+g7ovPbaxLpyLzjNahiVHr0e3ov15uzyy/lgdDM4Hxx/EC//Od7GEQBTWa0uAY/rCir3dw1qtKfBTezXNqbJWBY+fGuE8XzfLmfGZTDLW0RyC7mc7dxEqLVR8GmlC9Ps+Yur4BAW8HYW9WSR3DenBHfBOdxi9LoayF+t8+d1jGVx/SpiO/vuADjzsTMPefkdkkOBe8TbNBaBcLpsLLQnWJdJIVL6Lz3oTahiXKrPJF4hNQOB5ijHxiPevGmNLYIfjGeUZ9oxvS3eWQBSrfQ6oZjHNatWvk0AagPQVsBrAW9ZzacQx+5l1f/i+iBaRS8fOzL+5BpI32uAI5wtfy6sJ4Bt2hVMEpHt0sD7UC6Z+hQN7P6t/fwDDTJq2YANAAA=", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:52 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:49"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA92ZWW8bNxCA/0ohoH0KLd6HAKNQbCUO6iOwlcZNEQg8hvY2urq7ap0a/u+dlXW4iVsrsIEaetBqZ3gN5yOHHOm6FSezcd3qsBetMVzhy3g2HL5oTUv4o5jMqqVcQjUb1ij+et0qUqvTAumpNF4T/KZEMnwLHiQxgvvIsxYuQQv79CPA2i+LT41UQkYh3AoJqlgW07qYjFGJiuhruJiUn1E6OtnvHTaqoa+qIhdYdFvt7enJ/ru9PhaN0J5iOixiUTctPvROTwZH3eNfmlYlYFdp4HE6LU6ZI4wSzvvUdqjuSLfDtNVGfsCqs2l6uKqdV63iZAqD+eRDUimC98QLBUSaQInLURFrlGQ0S690xhZTX8K4vm3irJWOcUmYk45ITQVx4Dlh0jkZPKec+mZWkwTDeYslBxy0rAu443ochUKgmUQdIpHZU+IDz8RYSp2mTCiV165/Db6sVr6/WEhfOX8x0OdB/XnaNHtz3B/83D181/tmMJMyQdnqUHTuuFgtqD/8cAaDyXxEnMv1zUK1LH+QGWeUSXUPM04JRT/yPuMdYTuC7jjl1C0zJLDw/4br9dshf0lsMqunM7SsLmdw82KBjEVFlbWRCJMTmpAiwQXBCC4uz10E5WJaI+tPaj/87hKKi8t6Ra5ulGSlfBDg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MzaFrAQXDTcRcKNmBTJgTuCyizwIqX020USEjPudojd5tgkDADVqvpGPtgmxlvQKP9uEWIicfNAMOLcSkXIKXHjc1mCMzxFQTFakGDAu52wh8ujwHpUzF1y75JqTGe8Oc0iPRf0/Ad4KjphwUma5TNYEabiXHDHhMevAgzPgbFDWcS84WI9nLVhlvNNJcyOpTfOb7VZFY8HpFX62aatGhYkEhlmhMGN3RpoUMCQzDSkmhBOtp9wAlcEHqakJGKMxflshAo9BZdbCC/jtbzobOPof2cm/e3yZQn3DfzPLTGaZQt18lQwuR+lT15GsI8QO3hm1Fff9B3G3quhQs6O5k5Y/h2Tw45fyzd/7LHCM9RsAAA==", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:52 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:50"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"__Test context ref property @ 2024-09-16 10:55:50.559987\", \"part_id\": \"e4a047a6-4a00-41a6-bae4-732ac2f639de\", \"description\": \"Description of test ref property\", \"property_type\": \"CONTEXT_REFERENCES_VALUE\", \"value\": null, \"unit\": \"no unit\", \"value_options\": {}}"}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["270"], "Content-Type": ["application/json"]}, "method": "POST", "uri": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "response": {"body": {"encoding": "utf-8", "string": "{\"results\":[{\"id\":\"fb056108-af67-4ca5-8bd7-45550de1ba2e\",\"name\":\"__Test context ref property @ 2024-09-16 10:55:50.559987\",\"ref\":\"test-context-ref-property-2024-09-16-105550559987\",\"description\":\"Description of test ref property\",\"property_type\":\"CONTEXT_REFERENCES_VALUE\",\"category\":\"MODEL\",\"order\":8,\"unit\":\"no unit\",\"value_options\":{},\"value\":[],\"created_at\":\"2024-09-16T08:55:52.777032Z\",\"updated_at\":\"2024-09-16T08:55:52.787655Z\",\"part_id\":\"e4a047a6-4a00-41a6-bae4-732ac2f639de\",\"scope_id\":\"bd5dceaa-a35e-47b0-9fc5-875410f4a56f\",\"model_id\":null,\"output\":true}]}"}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:53 GMT"], "Content-Type": ["application/json"], "Content-Length": ["566"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["POST, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 201, "message": "Created"}, "url": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "recorded_at": "2024-09-16T08:55:51"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["0"]}, "method": "DELETE", "uri": "/api/v3/properties/fb056108-af67-4ca5-8bd7-45550de1ba2e.json"}, "response": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:53 GMT"], "Content-Type": ["application/json"], "Content-Length": ["14"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["GET, PUT, PATCH, DELETE, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 204, "message": "No Content"}, "url": "/api/v3/properties/fb056108-af67-4ca5-8bd7-45550de1ba2e.json"}, "recorded_at": "2024-09-16T08:55:51"}], "recorded_with": "betamax/0.9.0"} \ No newline at end of file diff --git a/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_valid_context_group.json b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_valid_context_group.json new file mode 100644 index 000000000..d78ad007d --- /dev/null +++ b/tests/cassettes/TestPropertiesContextReferencesPropertyPrefilters.test_set_prefilters_with_valid_context_group.json @@ -0,0 +1 @@ +{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA7VVwW7kNgz9FcPXRoEky7I9p20Xe9hD26DJ7qFFMKBleqLGtgxZnt1BMP9eypNMPEi37WF7MGBS5OMjKT8/pcbNQ0g34iod8Cu9DHPXXaWjx7118/Rie5zmLpD5x1Nqm3ST1k3eGARgkOXIVFFzVrUmZ2WRK8FbBbluU8KEHin6J/uIyY13f6IJaURrIwQ52Xh2hqV8+hyVzBM2SXBJwCkkN4dHNA9ghwSGJhnn6SGxYTl9wKSzvSVqV+kUIETK6Y/v7z5+/kAeAwF3zh/I9+n2w2/b2/e/3ix+j3TSbCFWlFxUTHAm5R0vN1xvVHldFirP8t8pdB6bdajMGM+YyO+E2uTlRqlrzrmueAwNsIsTWhoj8yubjBuRBfA7DOk9EYz21o3BuoEin1K3R+9tg7f01ODTTQvdhHFAtIAJB2roFEpj9+EwxlmaeQqu/2jcEBtxQ2t3Eaqx09jBYfHH2ZqD6SKLlf9n10QAj7u5o2LHI1E6of0Ce7tbalGp+2NcBvRb22xP+zvdgR77Gv3rHZClpvFM6J+XPM0j+r2dnH9dPL3ZaQsm2D2Zwc/UHPZgu/PZCfXcefTAALtL1wr6GYScHUJzkX28OhHLLmjFC/QC+X14nRmsab3GfZOXesMrmq+kPpGV3JH7n9jBu/p66C45ngn9y+j+A8fq7fBi7P+60b+nFaFfWIm3F+1ydLcr1zfpPbh4E6aA/ofR9hmLzb0jDVqU5dq4/vvzv49Sugja1g6ti1/XolM+bKOsvHxazYwXNuXsSADO8vvF+ce2c1+23jlCigLMBW+05oqp3NRMlUaxUuUF01mb81JqUGV7UkDo3G6V2LSoSKk5U5WWTLUVsEqVghVYywZKUSgJlAjjuErKashKhYrJohCUxDkDqsJqWbZC51nDpU4X3s1MvfakNN0psypLVQmpmKhUxZQm9awQJBOqqlQNpKgcVpl2oOkMBk/JoHmRoapZXgmgTkVGFYv4qwEtoJaQmWzV5KpsrbVQJhdM5jllSqxYmcmSKSF1gSJroChWmZdlK07AWAmGpdCUwoHVhggIrelnoXJoZZYe749/ASxW3Ws+BwAA", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:53 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/scopes.json?status=ACTIVE&name=Bike+Project&fields=id%2Cname%2Cref%2Ctext%2Ccreated_at%2Cupdated_at%2Cstart_date%2Cdue_date%2Cstatus%2Ccategory%2Cprogress%2Cmembers%2Cteam%2Ctags%2Cscope_options%2Cteam_id_name%2Cworkflow_root_id%2Ccatalog_root_id%2Capp_root_id%2Cproduct_model_id%2Cproduct_instance_id%2Ccatalog_model_id%2Ccatalog_instance_id%2Cproject_info&limit=2"}, "recorded_at": "2024-09-16T08:55:51"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA82WbW/iOBDHvwrK6xr5MXZ4h1q6V6kPp5bu6XqqkOOHxSokXHB6i6p+950AKbTlFlbVnfoqmfHYM/bvn4mfElPWRUx65Cgp3Hd4KerJ5CiZVe4xlPW8tSs3rycRzL+ekmCTXuIwEZI5ixTDCnFBMNLUW8RTbpixFmusElhTTx1E/zF2bpI0y3iw/llb1s1NFWYxlAV4wWF0dN/KagHWxdXJ4LxxTfR8HnyAoVXY79dXJ7fHQxiaQkVhNgkmxGbG3eD6anTRv/yzmVU5WMqONGwooZhkCOqjdIhVD6c9nnWVyKSSdxBaz+zeUIVJEzo35cyNltvPrbDGaY00Ew5xmWOUeSOQkoIT7LkWqYcZM125Iq6mOK4xlzpF8MSIE3jLteNIMqoN9SnLrGt2VVo3Wc5oSUDSKga3dfgpc4IqkyGrjESc5wTlubUoAyCO5JJqzDaHfxLgGV31cv5243iHYJ1uMYqLWTP59PyqPxx97Z/fDn4ZUFlZSNLDcMhFeJHWo57UblQuc8Kenp7XrqTHGe2SQ+BJznG6Ax6lCMRI8JDQHpU9gbsyk1LRuxWKFsRh0v112m/RlXWc1VBZrGr3fLRmBxMUZh4UoLIc2DGHtNIGcccp9blMNd9idzMrH4B8S27emnu5nV1+kBo5lBo+hFgmeUoOJpZ9KmLWu5wK6VGaYyCmrUFZCgBTq2RqqeeGiA2x6zDtXMAWq6A3Ha8KUzTdOPfSO/6tf/0xfPRQfEnf6qkuYqinhzTOjBLOxeEk089EMlPSZZrkUCaFtbBVSDnGEfGe2YwInRm7ITkMlesMx8E8FG6++QYjuFHccv8fPZQdinM1vh8jTzHe9UHuCBWYyk+FkROpUsUVyhmGtawWKHfQR73PmU2xgj8g32A8bi441aJT+g7ovPbaxLpyLzjNahiVHr0e3ov15uzyy/lgdDM4Hxx/EC//Od7GEQBTWa0uAY/rCir3dw1qtKfBTezXNqbJWBY+fGuE8XzfLmfGZTDLW0RyC7mc7dxEqLVR8GmlC9Ps+Yur4BAW8HYW9WSR3DenBHfBOdxi9LoayF+t8+d1jGVx/SpiO/vuADjzsTMPefkdkkOBe8TbNBaBcLpsLLQnWJdJIVL6Lz3oTahiXKrPJF4hNQOB5ijHxiPevGmNLYIfjGeUZ9oxvS3eWQBSrfQ6oZjHNatWvk0AagPQVsBrAW9ZzacQx+5l1f/i+iBaRS8fOzL+5BpI32uAI5wtfy6sJ4Bt2hVMEpHt0sD7UC6Z+hQN7P6t/fwDDTJq2YANAAA=", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:54 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Wheel&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:51"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "]}, "method": "GET", "uri": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA92ZWW8jNxKA/0ogYPdpaBVvUoARaGzNgfgY2JqMdxaBwKNo90aWtOpW4snA/31Lsg4ncWINbGANPajVLF7F+shilfS1lcazUdPq8FetEd7Qy2g2HL5qTab4SzWe1avyFOvZsKHiv7+2qtzqtFAFUDYYRt/AFKe3GFAxK0VIohjpM7ZozHCN1Pp19fO8NMVChXhXyFinaTVpqvGIhCRIocHL8fQLlY5PD3tHc9Ew1HVVKqq6a/bh7PTw40Gfqq5Jn2oyrFLVzHt87p2dDo67J/+a95oiDZUHgZbTEsA948CE6IPrgOkov8eNM1Z9pqazSX68qVs0rdN4goPF4mPWOWEILEiNTNkIzJekmbNacSgqaFOoxyRMcdTcdfHOKc+FYtwrz5QByTwGwbjyXsUgQECYr2q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98surk7Q8HF8fu4B/izXxe8NzQ69xK9LV4hF9rNZjif2dkieVYcz77q+Z0qrTW6vOybnGhY71vAJaSc1oZ5ncYaAPV+1fj9TDnqyXvcx6C00rQ+c0lBQN077jiPRjKt73K3vMSQ3bShaDpmIRAl0/RXDkvE3lror1TkDnV3swfuwQ55Zh9tBkxmwKFa22MN6FYKbMMWUYibDgELzEkG5OKimdHrk/JJCkIIcgX57tFGQgy7BJj0CgjEFa6PyW6glo7J4wt9BHJQDK6gIqWo87aaaRA0hhBkLWXjuJNYny8S4iNghv67BJihSAImnGaG20Lt5IwC+6K4pwD+jQPMo13EQOIQEFNVBTC0JEuNvmQ1PxmpthhAempqP9PgHeCIw3lfDFeS5GcS6iydOCRrGNLtBK99dlqTN4LKMhL0clCcdQhZpV0Io475Y2lgBv67NJRtZmMBQjWOKmSpSxQ8xh44VHFEmXOUdFNqzK30WEh95vQo0MA66LSxrcoAL/7TWcLQ/8uO/lri69SqG/4b2aVyaxSqNs/JYOrWfrgO4p3pNyTitOiH/oP4n5T2QG7ZyjCdOIlJIM//bF8+z/bdN3B9RsAAA==", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:54 GMT"], "Content-Type": ["application/json"], "Transfer-Encoding": ["chunked"], "Connection": ["keep-alive"], "Vary": ["Accept-Encoding", "Accept, Accept-Language, Cookie"], "allow": ["GET, POST, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"], "Content-Encoding": ["gzip"]}, "status": {"code": 200, "message": "OK"}, "url": "/api/v3/parts.json?name=Bike&category=MODEL&limit=2&scope_id=bd5dceaa-a35e-47b0-9fc5-875410f4a56f&fields=id%2Cname%2Cref%2Cdescription%2Ccreated_at%2Cupdated_at%2Cproperties%2Ccategory%2Cclassification%2Cparent_id%2Cmultiplicity%2Cvalue_options%2Cproperty_type%2Cvalue%2Coutput%2Corder%2Cpart_id%2Cscope_id%2Cmodel_id%2Cproxy_source_id_name%2Cunit"}, "recorded_at": "2024-09-16T08:55:52"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"__Test context ref property @ 2024-09-16 10:55:52.508936\", \"part_id\": \"e4a047a6-4a00-41a6-bae4-732ac2f639de\", \"description\": \"Description of test ref property\", \"property_type\": \"CONTEXT_REFERENCES_VALUE\", \"value\": null, \"unit\": \"no unit\", \"value_options\": {}}"}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["270"], "Content-Type": ["application/json"]}, "method": "POST", "uri": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "response": {"body": {"encoding": "utf-8", "string": "{\"results\":[{\"id\":\"eada96c7-5399-40dd-9d2a-afe114ad763c\",\"name\":\"__Test context ref property @ 2024-09-16 10:55:52.508936\",\"ref\":\"test-context-ref-property-2024-09-16-105552508936\",\"description\":\"Description of test ref property\",\"property_type\":\"CONTEXT_REFERENCES_VALUE\",\"category\":\"MODEL\",\"order\":8,\"unit\":\"no unit\",\"value_options\":{},\"value\":[],\"created_at\":\"2024-09-16T08:55:54.721738Z\",\"updated_at\":\"2024-09-16T08:55:54.733418Z\",\"part_id\":\"e4a047a6-4a00-41a6-bae4-732ac2f639de\",\"scope_id\":\"bd5dceaa-a35e-47b0-9fc5-875410f4a56f\",\"model_id\":null,\"output\":true}]}"}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:54 GMT"], "Content-Type": ["application/json"], "Content-Length": ["566"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["POST, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 201, "message": "Created"}, "url": "/api/v3/properties/create_model?fields=id%2Cname%2Cref%2Ccreated_at%2Cupdated_at%2Cmodel_id%2Cpart_id%2Corder%2Cscope_id%2Ccategory%2Cproperty_type%2Cvalue%2Cvalue_options%2Coutput%2Cdescription%2Cunit"}, "recorded_at": "2024-09-16T08:55:52"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": ["python-requests/2.32.3"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["*/*"], "Connection": ["keep-alive"], "X-Requested-With": ["XMLHttpRequest"], "PyKechain-Version": ["4.13.0"], "Authorization": ["Token "], "Content-Length": ["0"]}, "method": "DELETE", "uri": "/api/v3/properties/eada96c7-5399-40dd-9d2a-afe114ad763c.json"}, "response": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"Server": ["nginx"], "Date": ["Mon, 16 Sep 2024 08:55:55 GMT"], "Content-Type": ["application/json"], "Content-Length": ["14"], "Connection": ["keep-alive"], "vary": ["Accept, Accept-Language, Cookie"], "allow": ["GET, PUT, PATCH, DELETE, HEAD, OPTIONS"], "x-frame-options": ["SAMEORIGIN"], "content-language": ["en", "En"], "strict-transport-security": ["max-age=15768000; includeSubDomains"], "x-content-type-options": ["nosniff"], "referrer-policy": ["same-origin"], "cross-origin-opener-policy": ["same-origin"], "Ke-Chain": ["3"]}, "status": {"code": 204, "message": "No Content"}, "url": "/api/v3/properties/eada96c7-5399-40dd-9d2a-afe114ad763c.json"}, "recorded_at": "2024-09-16T08:55:53"}], "recorded_with": "betamax/0.9.0"} \ No newline at end of file diff --git a/tests/test_properties.py b/tests/test_properties.py index 79e138490..a951c71bf 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -559,3 +559,56 @@ def test_copy_reference_property_with_options(self): # tearDown copied_ref_property.delete() + + +class TestPropertiesContextReferencesPropertyPrefilters(TestBetamax): + def setUp(self): + super().setUp() + + self.wheel_model = self.project.model("Wheel") + self.bike = self.project.model("Bike") + + self.context_references_property = self.bike.add_property( + name=f"__Test context ref property @ {datetime.now()}", + property_type=PropertyType.CONTEXT_REFERENCES_VALUE, + description="Description of test ref property", + unit="no unit", + ) + + def tearDown(self): + self.context_references_property.delete() + super().tearDown() + + def test_set_prefilters_no_params(self): + self.context_references_property.set_prefilters() + self.assertEqual( + self.context_references_property._options.get("prefilters", {}), {} + ) + + def test_set_prefilters_with_prefilters(self): + with self.assertRaises(IllegalArgumentError): + self.context_references_property.set_prefilters( + prefilters={"something": "test"} + ) + + def test_set_prefilters_with_clear(self): + self.context_references_property._options["prefilters"] = { + "context_group": ContextGroup.ASSET + } + self.context_references_property.set_prefilters(clear=True) + self.assertEqual( + self.context_references_property._options.get("prefilters", {}), {} + ) + + def test_set_prefilters_with_valid_context_group(self): + self.context_references_property.set_prefilters( + context_group=ContextGroup.ASSET + ) + filter_option = self.context_references_property._options.get( + "prefilters", {} + ).get("context_group") + self.assertEqual(filter_option, ContextGroup.ASSET) + + def test_set_prefilters_with_invalid_context_group(self): + with self.assertRaises(IllegalArgumentError): + self.context_references_property.set_prefilters(context_group="invalid")