|
13 | 13 | PAGE_NUMBER_XML = os.path.join(TEST_ASSET_DIR, "request_option_page_number.xml") |
14 | 14 | PAGE_SIZE_XML = os.path.join(TEST_ASSET_DIR, "request_option_page_size.xml") |
15 | 15 | FILTER_EQUALS = os.path.join(TEST_ASSET_DIR, "request_option_filter_equals.xml") |
| 16 | +FILTER_NAME_IN = os.path.join(TEST_ASSET_DIR, "request_option_filter_name_in.xml") |
16 | 17 | FILTER_TAGS_IN = os.path.join(TEST_ASSET_DIR, "request_option_filter_tags_in.xml") |
17 | 18 | FILTER_MULTIPLE = os.path.join(TEST_ASSET_DIR, "request_option_filter_tags_in.xml") |
18 | 19 | SLICING_QUERYSET = os.path.join(TEST_ASSET_DIR, "request_option_slicing_queryset.xml") |
@@ -114,6 +115,30 @@ def test_filter_tags_in(self) -> None: |
114 | 115 | self.assertEqual(set(["safari"]), matching_workbooks[1].tags) |
115 | 116 | self.assertEqual(set(["sample"]), matching_workbooks[2].tags) |
116 | 117 |
|
| 118 | + # check if filtered projects with spaces & special characters |
| 119 | + # get correctly returned |
| 120 | + def test_filter_name_in(self) -> None: |
| 121 | + with open(FILTER_NAME_IN, "rb") as f: |
| 122 | + response_xml = f.read().decode("utf-8") |
| 123 | + with requests_mock.mock() as m: |
| 124 | + m.get( |
| 125 | + self.baseurl + "/projects?filter=name%3Ain%3A%5Bdefault%2CSalesforce+Sales+Proje%C5%9Bt%5D", |
| 126 | + text=response_xml, |
| 127 | + ) |
| 128 | + req_option = TSC.RequestOptions() |
| 129 | + req_option.filter.add( |
| 130 | + TSC.Filter( |
| 131 | + TSC.RequestOptions.Field.Name, |
| 132 | + TSC.RequestOptions.Operator.In, |
| 133 | + ["default", "Salesforce Sales Projeśt"], |
| 134 | + ) |
| 135 | + ) |
| 136 | + matching_projects, pagination_item = self.server.projects.get(req_option) |
| 137 | + |
| 138 | + self.assertEqual(2, pagination_item.total_available) |
| 139 | + self.assertEqual("default", matching_projects[0].name) |
| 140 | + self.assertEqual("Salesforce Sales Projeśt", matching_projects[1].name) |
| 141 | + |
117 | 142 | def test_filter_tags_in_shorthand(self) -> None: |
118 | 143 | with open(FILTER_TAGS_IN, "rb") as f: |
119 | 144 | response_xml = f.read().decode("utf-8") |
|
0 commit comments