diff --git a/dev-requirements.txt b/dev-requirements.txt index f17442192..460458434 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -black==21.8b0 +black==22.3.0 Faker==8.12.1 ipython isort diff --git a/requirements.txt b/requirements.txt index e12f78abf..d08e73749 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,36 +1,29 @@ alembic==1.6.5 APScheduler==3.8.0 -bcrypt~=3.2.0 boto3~=1.18.14 -click==7.1.2 +click==8.1.3 cryptography~=3.4.8 dask==2021.10.0 -email-validator emails fastapi-caching[redis] fastapi-pagination[sqlalchemy]~= 0.8.3 -fastapi[all]==0.68.1 +fastapi[all]==0.78.0 fideslang==1.0.0 multidimensional_urlencode==0.0.4 pandas==1.3.3 -passlib[bcrypt]==1.7.2 +passlib[bcrypt]==1.7.4 psycopg2-binary==2.9.1 -pydantic~=1.8.2 pydash==5.0.2 pyjwt pymongo==3.12.0 PyMySQL==1.0.2 -python-dotenv~=0.19.0 python-jose[cryptography]==3.3.0 redis==3.5.3 -requests~=2.25.0 snowflake-sqlalchemy==1.3.2 sqlalchemy-bigquery==1.3.0 sqlalchemy-redshift==0.8.8 sqlalchemy-stubs==0.4 SQLAlchemy-Utils==0.37.8 sqlalchemy==1.4.14 -starlette~=0.14.2 Unidecode==1.2.0 -uvicorn~=0.13.4 versioneer==0.19 diff --git a/src/fidesops/graph/config.py b/src/fidesops/graph/config.py index 17fbe6e93..d1fc0d037 100644 --- a/src/fidesops/graph/config.py +++ b/src/fidesops/graph/config.py @@ -293,6 +293,12 @@ def collect_matching(self, func: Callable[[Field], bool]) -> Dict[FieldPath, Fie return {FieldPath(self.name): self} # pylint: disable=no-member return {} + def __eq__(self, other: object) -> bool: + if not isinstance(other, ScalarField): + return False + + return self.__dict__ == other.__dict__ + class ObjectField(Field): """A field that represents a json dict structure.""" @@ -345,6 +351,15 @@ def collect_matching(self, func: Callable[[Field], bool]) -> Dict[FieldPath, Fie }, ) + def __eq__(self, other: object) -> bool: + if not isinstance(other, ObjectField): + return False + + print(f"{self.__dict__=}") + print(f"{other.__dict__=}") + + return self.__dict__ == other.__dict__ + # pylint: disable=too-many-arguments def generate_field( diff --git a/src/fidesops/graph/data_type.py b/src/fidesops/graph/data_type.py index 3eb5560a1..b39ef3036 100644 --- a/src/fidesops/graph/data_type.py +++ b/src/fidesops/graph/data_type.py @@ -34,6 +34,12 @@ def truncate(self, length: int, val: T) -> T: ) return val + def __eq__(self, other: object) -> bool: + if not isinstance(other, DataTypeConverter): + return False + + return self.__dict__ == other.__dict__ + class NoOpTypeConverter(DataTypeConverter[Any]): """Placeholder No-op converter. This type is assigned to fields when type is unspecified.""" @@ -133,6 +139,12 @@ def to_value(self, other: Any) -> Optional[ObjectId]: return None return None + def __eq__(self, other: object) -> bool: + if not isinstance(other, ObjectTypeConverter): + return False + + return self.__dict__ == other.__dict__ + class ObjectTypeConverter(DataTypeConverter[Dict[str, Any]]): """Json data type converter.""" @@ -146,6 +158,12 @@ def to_value(self, other: Any) -> Optional[Dict[str, Any]]: return other return None + def __eq__(self, other: object) -> bool: + if not isinstance(other, ObjectTypeConverter): + return False + + return self.__dict__ == other.__dict__ + class DataType(Enum): """Supported data types for data retrieval and erasure. diff --git a/tests/graph/test_config.py b/tests/graph/test_config.py index 9cb17c59c..e8f969e73 100644 --- a/tests/graph/test_config.py +++ b/tests/graph/test_config.py @@ -308,6 +308,7 @@ def _is_string_field(f: Field): assert ( isinstance(object_array_field, ObjectField) and object_array_field.is_array ) + print(object_field) assert object_array_field.fields["obj"] == object_field def test_field_data_type(self): diff --git a/tests/service/connectors/test_queryconfig.py b/tests/service/connectors/test_queryconfig.py index 5e21ae28e..d41d91278 100644 --- a/tests/service/connectors/test_queryconfig.py +++ b/tests/service/connectors/test_queryconfig.py @@ -70,29 +70,23 @@ def found_query_keys(node: TraversalNode, values: Dict[str, Any]) -> Set[str]: } # values exist for all query keys - assert ( - found_query_keys( - payment_card_node, - { - "id": ["A"], - "customer_id": ["V"], - "ignore_me": ["X"], - }, - ) - == {"id", "customer_id"} - ) + assert found_query_keys( + payment_card_node, + { + "id": ["A"], + "customer_id": ["V"], + "ignore_me": ["X"], + }, + ) == {"id", "customer_id"} # with no values OR an empty set, these are omitted - assert ( - found_query_keys( - payment_card_node, - { - "id": ["A"], - "customer_id": [], - "ignore_me": ["X"], - }, - ) - == {"id"} - ) + assert found_query_keys( + payment_card_node, + { + "id": ["A"], + "customer_id": [], + "ignore_me": ["X"], + }, + ) == {"id"} assert found_query_keys( payment_card_node, {"id": ["A"], "ignore_me": ["X"]} ) == {"id"} @@ -100,27 +94,21 @@ def found_query_keys(node: TraversalNode, values: Dict[str, Any]) -> Set[str]: assert found_query_keys(payment_card_node, {}) == set() def test_typed_filtered_values(self): - assert ( - payment_card_node.typed_filtered_values( - { - "id": ["A"], - "customer_id": ["V"], - "ignore_me": ["X"], - } - ) - == {"id": ["A"], "customer_id": ["V"]} - ) + assert payment_card_node.typed_filtered_values( + { + "id": ["A"], + "customer_id": ["V"], + "ignore_me": ["X"], + } + ) == {"id": ["A"], "customer_id": ["V"]} - assert ( - payment_card_node.typed_filtered_values( - { - "id": ["A"], - "customer_id": [], - "ignore_me": ["X"], - } - ) - == {"id": ["A"]} - ) + assert payment_card_node.typed_filtered_values( + { + "id": ["A"], + "customer_id": [], + "ignore_me": ["X"], + } + ) == {"id": ["A"]} assert payment_card_node.typed_filtered_values( {"id": ["A"], "ignore_me": ["X"]}