Ticket #12412: 12412_testing_docs.diff

File 12412_testing_docs.diff, 1.1 KB (added by gabrielhurley, 5 years ago)

Adds notes about file handling to testing docs.

  • docs/topics/testing.txt

     
    667667
    668668        (The name ``attachment`` here is not relevant; use whatever name your
    669669        file-processing code expects.)
     670       
     671        Note that if you wish to use the same file handle for multiple
     672        ``post()`` calls then you will need to manually reset the file pointer
     673        between posts. It is best practice to manually close the file
     674        after it has been provided to ``post()``, as demonstrated above.
     675       
     676        It can also be helpful to open file handles in ``rb`` (read binary)
     677        mode for sending via ``post()``. This is particularly true for image
     678        files and other data not in plain text format.
    670679
    671         Note that you should manually close the file after it has been provided
    672         to ``post()``.
    673 
    674680        The ``extra`` argument acts the same as for :meth:`Client.get`.
    675681
    676682        .. versionchanged:: 1.1
Back to Top