def test_filter_values_adhoc_filters(self) -> None: with app.test_request_context( data={ "form_data": json.dumps({ "adhoc_filters": [{ "clause": "WHERE", "comparator": "foo", "expressionType": "SIMPLE", "operator": "in", "subject": "name", }], }) }): cache = ExtraCache() self.assertEqual(cache.filter_values("name"), ["foo"]) self.assertEqual(cache.applied_filters, ["name"]) with app.test_request_context( data={ "form_data": json.dumps({ "adhoc_filters": [{ "clause": "WHERE", "comparator": ["foo", "bar"], "expressionType": "SIMPLE", "operator": "in", "subject": "name", }], }) }): cache = ExtraCache() self.assertEqual(cache.filter_values("name"), ["foo", "bar"]) self.assertEqual(cache.applied_filters, ["name"])
def test_filter_values_extra_filters(self) -> None: with app.test_request_context( data={ "form_data": json.dumps( {"extra_filters": [{"col": "name", "op": "in", "val": "foo"}]} ) } ): cache = ExtraCache() self.assertEqual(cache.filter_values("name"), ["foo"])
def test_filter_values_extra_filters(app_context: AppContext) -> None: with app.test_request_context( data={ "form_data": json.dumps( {"extra_filters": [{"col": "name", "op": "in", "val": "foo"}]} ) } ): cache = ExtraCache() assert cache.filter_values("name") == ["foo"] assert cache.applied_filters == ["name"]
def test_filter_values_no_default(app_context: AppContext) -> None: cache = ExtraCache() assert cache.filter_values("name") == []
def test_filter_values_remove_not_present(app_context: AppContext) -> None: cache = ExtraCache() assert cache.filter_values("name", remove_filter=True) == [] assert cache.removed_filters == []
def test_filter_values_default(app_context: AppContext) -> None: cache = ExtraCache() assert cache.filter_values("name", "foo") == ["foo"] assert cache.removed_filters == []
def test_filter_values_no_default(self) -> None: with app.test_request_context(): cache = ExtraCache() self.assertEqual(cache.filter_values("name"), [])
def test_filter_values_remove_not_present(self) -> None: with app.test_request_context(): cache = ExtraCache() self.assertEqual(cache.filter_values("name", remove_filter=True), []) self.assertEqual(cache.removed_filters, list())
def test_filter_values_default(self) -> None: with app.test_request_context(): cache = ExtraCache() self.assertEqual(cache.filter_values("name", "foo"), ["foo"]) self.assertEqual(cache.removed_filters, list())
def test_filter_values_no_default() -> None: cache = ExtraCache() assert cache.filter_values("name") == []