Skip to content

Commit

Permalink
Make QueryStringWidgetTests more robust/independent of implementation…
Browse files Browse the repository at this point in the history
… details
  • Loading branch information
jensens committed Apr 8, 2019
1 parent dbf8d54 commit 107a89b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 4 additions & 11 deletions Products/Archetypes/tests/test_pawidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions news/124.bugfix
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 107a89b

Please sign in to comment.