{"action":"created","issue":{"url":"https://api.github.com/repos/wagtail/wagtail/issues/4232","repository_url":"https://api.github.com/repos/wagtail/wagtail","labels_url":"https://api.github.com/repos/wagtail/wagtail/issues/4232/labels{/name}","comments_url":"https://api.github.com/repos/wagtail/wagtail/issues/4232/comments","events_url":"https://api.github.com/repos/wagtail/wagtail/issues/4232/events","html_url":"https://github.com/wagtail/wagtail/issues/4232","id":293237653,"number":4232,"title":"Test fails with Wagtail 2beta ","user":{"login":"jossingram","id":5364807,"avatar_url":"https://avatars1.githubusercontent.com/u/5364807?v=4","gravatar_id":"","url":"https://api.github.com/users/jossingram","html_url":"https://github.com/jossingram","followers_url":"https://api.github.com/users/jossingram/followers","following_url":"https://api.github.com/users/jossingram/following{/other_user}","gists_url":"https://api.github.com/users/jossingram/gists{/gist_id}","starred_url":"https://api.github.com/users/jossingram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jossingram/subscriptions","organizations_url":"https://api.github.com/users/jossingram/orgs","repos_url":"https://api.github.com/users/jossingram/repos","events_url":"https://api.github.com/users/jossingram/events{/privacy}","received_events_url":"https://api.github.com/users/jossingram/received_events","type":"User","site_admin":false},"labels":[{"id":190905941,"url":"https://api.github.com/repos/wagtail/wagtail/labels/Release%20blocker","name":"Release blocker","color":"ff0000","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/wagtail/wagtail/milestones/46","html_url":"https://github.com/wagtail/wagtail/milestone/46","labels_url":"https://api.github.com/repos/wagtail/wagtail/milestones/46/labels","id":2819903,"number":46,"title":"2.0","description":"","creator":{"login":"gasman","id":85097,"avatar_url":"https://avatars2.githubusercontent.com/u/85097?v=4","gravatar_id":"","url":"https://api.github.com/users/gasman","html_url":"https://github.com/gasman","followers_url":"https://api.github.com/users/gasman/followers","following_url":"https://api.github.com/users/gasman/following{/other_user}","gists_url":"https://api.github.com/users/gasman/gists{/gist_id}","starred_url":"https://api.github.com/users/gasman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasman/subscriptions","organizations_url":"https://api.github.com/users/gasman/orgs","repos_url":"https://api.github.com/users/gasman/repos","events_url":"https://api.github.com/users/gasman/events{/privacy}","received_events_url":"https://api.github.com/users/gasman/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":83,"state":"open","created_at":"2017-10-06T13:20:02Z","updated_at":"2018-02-14T17:21:10Z","due_on":"2017-12-31T08:00:00Z","closed_at":null},"comments":4,"created_at":"2018-01-31T17:05:28Z","updated_at":"2018-02-14T19:50:59Z","closed_at":null,"author_association":"NONE","body":"### Issue Summary\r\n\r\nA \"self.assertCanCreate(self.root, ArticlePage, {\" line which has this below to test streamfield content is failing on the google_map line.\r\n\r\n     'page_content': json.dumps([\r\n                    {\"type\": \"heading\", \"value\": \"Heading Test\"},\r\n                    {\"type\": \"embedded_video\", \"value\": \"https://xxxxxxxxxxxxxxxxxxx\"},\r\n                    {\"type\": \"fox_stories\", \"value\": {\"display_mode\": \"standard\", \"tagged_by_keyword\": \"business\", \"stories_limit\": \"4\"}},\r\n                    {\"type\": \"paragraph\", \"value\": \"<p>This is text</p>\"},\r\n                    {\"type\": \"google_map\", \"value\": {\"map_pins\": [], \"map_lat\": \"12.3434\", \"map_zoom_level\": \"14\", \"map_long\": \"-52.34334\"}}\r\n                ]),\r\n\r\nError from running tests: \r\n\r\n    Traceback (most recent call last):\r\n      File \"/code/researchsite/tests/test_create_pages.py\", line 64, in test_can_create_article_page\r\n        {\"type\": \"google_map\", \"value\": {\"map_pins\": [], \"map_lat\": \"12.3434\", \"map_zoom_level\": \"14\", \"map_long\": \"-52.34334\"}}\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/tests/utils.py\", line 275, in assertCanCreate\r\n        response = self.client.post(add_url, data, follow=True)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/test/client.py\", line 548, in post\r\n        secure=secure, **extra)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/test/client.py\", line 350, in post\r\n        secure=secure, **extra)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/test/client.py\", line 416, in generic\r\n        return self.request(**r)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/test/client.py\", line 501, in request\r\n        six.reraise(*exc_info)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/utils/six.py\", line 686, in reraise\r\n        raise value\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py\", line 41, in inner\r\n        response = get_response(request)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py\", line 249, in _legacy_get_response\r\n        response = self._get_response(request)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py\", line 187, in _get_response\r\n        response = self.process_exception_by_middleware(e, request)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py\", line 185, in _get_response\r\n        response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/views/decorators/cache.py\", line 43, in _cache_controlled\r\n        response = viewfunc(request, *args, **kw)\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/admin/urls/__init__.py\", line 95, in wrapper\r\n        return view_func(request, *args, **kwargs)\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/admin/decorators.py\", line 28, in decorated_view\r\n        return view_func(request, *args, **kwargs)\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/admin/views/pages.py\", line 194, in create\r\n        if form.is_valid():\r\n      File \"/usr/local/lib/python3.5/dist-packages/modelcluster/forms.py\", line 308, in is_valid\r\n        form_is_valid = super(ClusterForm, self).is_valid()\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/forms/forms.py\", line 183, in is_valid\r\n        return self.is_bound and not self.errors\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/forms/forms.py\", line 175, in errors\r\n        self.full_clean()\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/forms/forms.py\", line 384, in full_clean\r\n        self._clean_fields()\r\n      File \"/usr/local/lib/python3.5/dist-packages/django/forms/forms.py\", line 396, in _clean_fields\r\n        value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/core/blocks/base.py\", line 512, in value_from_datadict\r\n        return self.block_def.value_from_datadict(data, files, name)\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/core/blocks/stream_block.py\", line 162, in value_from_datadict\r\n        child_block.value_from_datadict(data, files, '%s-%d-value' % (prefix, i)),\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/core/blocks/field_block.py\", line 69, in value_from_datadict\r\n        return self.value_from_form(self.field.widget.value_from_datadict(data, files, prefix))\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/admin/rich_text/editors/draftail/__init__.py\", line 56, in value_from_datadict\r\n        return self.converter.to_database_format(original_value)\r\n      File \"/usr/local/lib/python3.5/dist-packages/wagtail/admin/rich_text/converters/contentstate.py\", line 93, in to_database_format\r\n        return self.exporter.render(json.loads(contentstate_json))\r\n      File \"/usr/lib/python3.5/json/__init__.py\", line 319, in loads\r\n        return _default_decoder.decode(s)\r\n      File \"/usr/lib/python3.5/json/decoder.py\", line 339, in decode\r\n        obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r\n      File \"/usr/lib/python3.5/json/decoder.py\", line 357, in raw_decode\r\n        raise JSONDecodeError(\"Expecting value\", s, err.value) from None\r\n    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\r\n\r\n\r\nNot sure what this is, possibly not a bug but something I've done wrong, think I've renamed all the module names though as in the release notes. \r\n\r\n### Technical details\r\n\r\n* Python version: Python3.5\r\n* Django version:1.11.9\r\n* Wagtail version: 2 beta\r\n"},"comment":{"url":"https://api.github.com/repos/wagtail/wagtail/issues/comments/365724695","html_url":"https://github.com/wagtail/wagtail/issues/4232#issuecomment-365724695","issue_url":"https://api.github.com/repos/wagtail/wagtail/issues/4232","id":365724695,"user":{"login":"gasman","id":85097,"avatar_url":"https://avatars2.githubusercontent.com/u/85097?v=4","gravatar_id":"","url":"https://api.github.com/users/gasman","html_url":"https://github.com/gasman","followers_url":"https://api.github.com/users/gasman/followers","following_url":"https://api.github.com/users/gasman/following{/other_user}","gists_url":"https://api.github.com/users/gasman/gists{/gist_id}","starred_url":"https://api.github.com/users/gasman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasman/subscriptions","organizations_url":"https://api.github.com/users/gasman/orgs","repos_url":"https://api.github.com/users/gasman/repos","events_url":"https://api.github.com/users/gasman/events{/privacy}","received_events_url":"https://api.github.com/users/gasman/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T19:50:59Z","updated_at":"2018-02-14T19:50:59Z","author_association":"COLLABORATOR","body":"PR now created: #4287\r\n\r\n@jossingram With the new helper functions introduced here, your test will now become:\r\n\r\n    from wagtail.tests.utils.form_data import inline_formset, nested_form_data, rich_text, streamfield\r\n\r\n    # ...\r\n\r\n    def test_can_create_article_page(self):\r\n        self.assertCanCreate(self.root, ArticlePage, nested_form_data({\r\n            'title': 'About us',\r\n            'side_nav':True,\r\n            'side_nav_mode':'siblings',\r\n            'page_content': streamfield([\r\n                ('heading', 'Heading Test'),\r\n                ('embedded_video', 'https://www.youtube.com/watch?v=xxxxxxxx'),\r\n                ('fox_stories', {'tagged_by_keyword': 'business', 'display_mode': 'standard', 'stories_limit': '4'}),\r\n                ('paragraph', rich_text('<p>This is text</p>')),\r\n                ('google_map', {'map_pins': '', 'map_lat': '12.3434', 'map_zoom_level': '14', 'map_long': '-52.34334', 'map_pins-count': 0})\r\n            ]),\r\n            'related_links': inline_formset([]),\r\n        }))\r\n\r\n(I'm not 100% sure I've got the StructBlocks right - will have to add another test case for those. Having said that, wrapping `'<p>This is text</p>'` as `rich_text('<p>This is text</p>')` should be the only change required to make the test pass.)\r\n\r\nIncidentally, I'm pretty sure the `page_content` JSON is redundant in your code above - the form processing logic will pick up the values from the individual fields instead."}}
{"actor":{"display_login":"gasman"}}