Skip to content

Commit

Permalink
Fix default value for delete params argument.
Browse files Browse the repository at this point in the history
This fixes #50 in Pylons/webtest.
  • Loading branch information
noonat committed Aug 1, 2013
1 parent f8488ac commit f263aab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ News

- Fixed #72. Use WSGIServer new api even if there waitress has backward compat.
[gawel]
- Fixed #50. Corrected default value for the delete params argument. [noonat]


2.0.6 (2013-05-23)
Expand Down
11 changes: 11 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import six
import mock
import webtest
import warnings


class TestApp(unittest.TestCase):
Expand Down Expand Up @@ -51,6 +52,16 @@ def test_get_params(self):
resp = self.app.get('/?a=b&c=d', dict(e='f'))
resp.mustcontain('a=b', 'c=d', 'e=f')

def test_delete_params_warning(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
self.app.delete('/')
self.assertEqual(len(w), 0, "We should not have any warnings")
self.app.delete('/', params=dict(a=1))
self.assertEqual(len(w), 1, "We should have one warning")
self.assertTrue("DELETE" in str(w[-1].message),
"The warning message should say something about DELETE")

def test_request_with_testrequest(self):
req = webtest.TestRequest.blank('/')
resp = self.app.request(req, method='POST')
Expand Down
5 changes: 3 additions & 2 deletions webtest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ def patch(self, url, params='', headers=None, extra_environ=None,
content_type=content_type,
)

def delete(self, url, params='', headers=None, extra_environ=None,
status=None, expect_errors=False, content_type=None):
def delete(self, url, params=utils.NoDefault, headers=None,
extra_environ=None, status=None, expect_errors=False,
content_type=None):
"""
Do a DELETE request. Similar to :meth:`~webtest.TestApp.get`.
Expand Down

0 comments on commit f263aab

Please sign in to comment.