Commit 579b6a50 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Allow POST to be given as a dict to Browser.open() for readability sake in test script.

parent 7269f4b6
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
############################################################################## ##############################################################################
import logging import logging
import sys import sys
import urllib
from urlparse import urljoin from urlparse import urljoin
from z3c.etestbrowser.browser import ExtendedTestBrowser from z3c.etestbrowser.browser import ExtendedTestBrowser
from zope.testbrowser.browser import onlyOne from zope.testbrowser.browser import onlyOne
...@@ -198,6 +199,9 @@ class Browser(ExtendedTestBrowser): ...@@ -198,6 +199,9 @@ class Browser(ExtendedTestBrowser):
# ERP5 base URL # ERP5 base URL
absolute_url = urljoin(self._erp5_base_url, url_or_path) absolute_url = urljoin(self._erp5_base_url, url_or_path)
if isinstance(data, dict):
data = urllib.urlencode(data)
self._logger.debug("Opening url: " + absolute_url) self._logger.debug("Opening url: " + absolute_url)
super(Browser, self).open(absolute_url, data) super(Browser, self).open(absolute_url, data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment