From 107a89b86ec6bfe50137f20861d863d904b2253e Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Mon, 8 Apr 2019 16:28:17 +0200 Subject: [PATCH] Make QueryStringWidgetTests more robust/independent of implementation details --- Products/Archetypes/tests/test_pawidgets.py | 15 ++++----------- news/124.bugfix | 4 ++++ 2 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 news/124.bugfix diff --git a/Products/Archetypes/tests/test_pawidgets.py b/Products/Archetypes/tests/test_pawidgets.py index 1b6d2f67..9e7ab0c5 100644 --- a/Products/Archetypes/tests/test_pawidgets.py +++ b/Products/Archetypes/tests/test_pawidgets.py @@ -599,23 +599,16 @@ def test_widget(self): ] widget = QueryStringWidget() - - self.assertEqual( + base_args = widget._base_args(self.context, self.field, self.request) + self.assertDictContainsSubset( { 'name': 'fieldname', 'value': '[{"query": "string1"}, {"query": "string2"}]', 'pattern': 'querystring', - 'pattern_options': { - 'indexOptionsUrl': '/@@qsOptions', - 'previewCountURL': '/@@querybuildernumberofresults', - 'previewURL': '/@@querybuilder_html_results', - 'patternAjaxSelectOptions': None, - 'patternDateOptions': None, - 'patternRelateditemsOptions': None, - }, }, - widget._base_args(self.context, self.field, self.request), + base_args, ) + self.assertIn('pattern_options', base_args.keys()) class TinyMCEWidgetTests(unittest.TestCase): diff --git a/news/124.bugfix b/news/124.bugfix new file mode 100644 index 00000000..493cfe73 --- /dev/null +++ b/news/124.bugfix @@ -0,0 +1,4 @@ +Problem: refactoring plone.app.widgets is not easy with too detailed expectations on the output of the pattern_options. +Its also outside the scope of this test. +Solution: check if there are pattern_options, but now what they are exactly. +[jensens]