Ticket #9607: add-extra-parameter-to-testing-doc.diff
File add-extra-parameter-to-testing-doc.diff, 2.8 KB (added by , 16 years ago) |
---|
-
docs/topics/testing.txt
478 478 Once you have a ``Client`` instance, you can call any of the following 479 479 methods: 480 480 481 .. method:: Client.get(path, data={} )481 .. method:: Client.get(path, data={}, **extra) 482 482 483 483 Makes a GET request on the provided ``path`` and returns a ``Response`` 484 484 object, which is documented below. … … 493 493 494 494 /customers/details/?name=fred&age=7 495 495 496 The ``extra`` keyword arguments parameter can be used to specify 497 headers to be sent in the request. For example:: 498 499 >>> c = Client() 500 >>> c.get('/customers/details/', {'name': 'fred', 'age': 7}, 501 ... HTTP_X_REQUESTED_WITH='XMLHttpRequest') 502 503 ...this will send the HTTP header ``HTTP_X_REQUESTED_WITH`` to the 504 details view, which is a good way to test code paths that use the 505 :meth:`django.http.HttpRequest.is_ajax()` method. 506 496 507 .. versionadded:: development 497 508 498 509 If you already have the GET arguments in URL-encoded form, you can … … 505 516 If you provide URL both an encoded GET data and a data argument, 506 517 the data argument will take precedence. 507 518 508 .. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT )519 .. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT, **extra) 509 520 510 521 Makes a POST request on the provided ``path`` and returns a 511 522 ``Response`` object, which is documented below. … … 568 579 to retrieve the username and password, and could interrogate request.GET 569 580 to determine if the user was a visitor. 570 581 571 .. method:: Client.head(path, data={} )582 .. method:: Client.head(path, data={}, **extra) 572 583 573 584 .. versionadded:: development 574 585 … … 576 587 object. Useful for testing RESTful interfaces. Acts just like 577 588 :meth:`Client.get` except it does not return a message body. 578 589 579 .. method:: Client.options(path, data={} )590 .. method:: Client.options(path, data={}, **extra) 580 591 581 592 .. versionadded:: development 582 593 583 594 Makes an OPTIONS request on the provided ``path`` and returns a 584 595 ``Response`` object. Useful for testing RESTful interfaces. 585 596 586 .. method:: Client.put(path, data={}, content_type=MULTIPART_CONTENT )597 .. method:: Client.put(path, data={}, content_type=MULTIPART_CONTENT, **extra) 587 598 588 599 .. versionadded:: development 589 600 … … 591 602 ``Response`` object. Useful for testing RESTful interfaces. Acts just 592 603 like :meth:`Client.post` except with the PUT request method. 593 604 594 .. method:: Client.delete(path )605 .. method:: Client.delete(path, **extra) 595 606 596 607 .. versionadded:: development 597 608