diff --git a/django/test/client.py b/django/test/client.py
index 5dbc3e3..cdc63a5 100644
|
a
|
b
|
class RequestFactory(object):
|
| 276 | 276 | path = path.encode('utf-8').decode('iso-8859-1') |
| 277 | 277 | return path |
| 278 | 278 | |
| 279 | | def get(self, path, data={}, secure=False, **extra): |
| | 279 | def get(self, path, data=None, secure=False, **extra): |
| 280 | 280 | "Construct a GET request." |
| 281 | 281 | |
| | 282 | if not data: |
| | 283 | data = {} |
| | 284 | |
| 282 | 285 | r = { |
| 283 | 286 | 'QUERY_STRING': urlencode(data, doseq=True), |
| 284 | 287 | } |
| 285 | 288 | r.update(extra) |
| 286 | 289 | return self.generic('GET', path, secure=secure, **r) |
| 287 | 290 | |
| 288 | | def post(self, path, data={}, content_type=MULTIPART_CONTENT, |
| | 291 | def post(self, path, data=None, content_type=MULTIPART_CONTENT, |
| 289 | 292 | secure=False, **extra): |
| 290 | 293 | "Construct a POST request." |
| 291 | 294 | |
| | 295 | if not data: |
| | 296 | data = {} |
| | 297 | |
| 292 | 298 | post_data = self._encode_data(data, content_type) |
| 293 | 299 | |
| 294 | 300 | return self.generic('POST', path, post_data, content_type, |
| 295 | 301 | secure=secure, **extra) |
| 296 | 302 | |
| 297 | | def head(self, path, data={}, secure=False, **extra): |
| | 303 | def head(self, path, data=None, secure=False, **extra): |
| 298 | 304 | "Construct a HEAD request." |
| 299 | 305 | |
| | 306 | if not data: |
| | 307 | data= {} |
| | 308 | |
| 300 | 309 | r = { |
| 301 | 310 | 'QUERY_STRING': urlencode(data, doseq=True), |
| 302 | 311 | } |
| … |
… |
class Client(RequestFactory):
|
| 460 | 469 | signals.template_rendered.disconnect(dispatch_uid=signal_uid) |
| 461 | 470 | got_request_exception.disconnect(dispatch_uid="request-exception") |
| 462 | 471 | |
| 463 | | def get(self, path, data={}, follow=False, secure=False, **extra): |
| | 472 | def get(self, path, data=None, follow=False, secure=False, **extra): |
| 464 | 473 | """ |
| 465 | 474 | Requests a response from the server using GET. |
| 466 | 475 | """ |
| … |
… |
class Client(RequestFactory):
|
| 470 | 479 | response = self._handle_redirects(response, **extra) |
| 471 | 480 | return response |
| 472 | 481 | |
| 473 | | def post(self, path, data={}, content_type=MULTIPART_CONTENT, |
| | 482 | def post(self, path, data=None, content_type=MULTIPART_CONTENT, |
| 474 | 483 | follow=False, secure=False, **extra): |
| 475 | 484 | """ |
| 476 | 485 | Requests a response from the server using POST. |
| … |
… |
class Client(RequestFactory):
|
| 482 | 491 | response = self._handle_redirects(response, **extra) |
| 483 | 492 | return response |
| 484 | 493 | |
| 485 | | def head(self, path, data={}, follow=False, secure=False, **extra): |
| | 494 | def head(self, path, data=None, follow=False, secure=False, **extra): |
| 486 | 495 | """ |
| 487 | 496 | Request a response from the server using HEAD. |
| 488 | 497 | """ |
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 5fa6360..2a71ba5 100644
|
a
|
b
|
class ClientTest(TestCase):
|
| 65 | 65 | self.assertTemplateNotUsed(response, 'Empty GET Template') |
| 66 | 66 | self.assertTemplateUsed(response, 'Empty POST Template') |
| 67 | 67 | |
| | 68 | def test_no_post(self): |
| | 69 | "POST an empty dictionary to a view" |
| | 70 | response = self.client.post('/test_client/post_view/') |
| | 71 | |
| | 72 | # Check some response details |
| | 73 | self.assertEqual(response.status_code, 200) |
| | 74 | self.assertEqual(response.templates[0].name, 'Empty POST Template') |
| | 75 | self.assertTemplateNotUsed(response, 'Empty GET Template') |
| | 76 | self.assertTemplateUsed(response, 'Empty POST Template') |
| | 77 | |
| 68 | 78 | def test_post(self): |
| 69 | 79 | "POST some data to a view" |
| 70 | 80 | post_data = { |