-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: auth tenant user not match
id
field (#1406)
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ def _initialize(self, default_tenant, tenant_user_custom_fields): | |
@pytest.mark.parametrize( | ||
("field", "excepted_filter_key"), | ||
[ | ||
("id", "id"), | ||
("username", "username"), | ||
("full_name", "full_name"), | ||
("phone_country_code", "phone_country_code"), | ||
|
@@ -107,10 +108,25 @@ def test_convert_one_rule_to_queryset_filter_for_source_data(self, source_data, | |
& Q(extras__region="[email protected]") | ||
), | ||
), | ||
# ID Field Compare rule | ||
( | ||
DataSourceMatchRule( | ||
data_source_id=1, | ||
field_compare_rules=[FieldCompareRule(source_field="id", target_field="id")], | ||
), | ||
(Q(data_source_id=1) & Q(id=100)), | ||
), | ||
( | ||
DataSourceMatchRule( | ||
data_source_id=1, | ||
field_compare_rules=[FieldCompareRule(source_field="user_id", target_field="id")], | ||
), | ||
(Q(data_source_id=1) & Q(id="test_username")), | ||
), | ||
], | ||
) | ||
def test_convert_one_rule_to_queryset_filter_for_rule(self, rule, excepted_queryset): | ||
source_data = {"user_id": "test_username", "phone": "1234567890123", "email": "[email protected]"} | ||
source_data = {"id": 100, "user_id": "test_username", "phone": "1234567890123", "email": "[email protected]"} | ||
|
||
queryset = self.matcher._convert_one_rule_to_queryset_filter(rule, source_data) | ||
|
||
|