summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Lange <jml@canonical.com>2010-12-29 19:08:19 +0000
committerJonathan Lange <jml@canonical.com>2010-12-29 19:08:19 +0000
commitff6e7db28d85e87ab3767359e06292c6bd2aeef6 (patch)
treea6a1364c7e1fc6c7a268639d05269ea7ebe86140
parent3b6ace4a7459630deaba1e00518a41c9bfff5dbe (diff)
downloadtesttools-ff6e7db28d85e87ab3767359e06292c6bd2aeef6.tar.gz
Update NEWS and MANUAL.
-rw-r--r--NEWS4
-rw-r--r--doc/for-test-authors.rst6
2 files changed, 7 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index a4b531f..846b247 100644
--- a/NEWS
+++ b/NEWS
@@ -21,8 +21,8 @@ Improvements
* ``MultiTestResult`` now documented in the manual. (Jonathan Lange, #661116)
-* New content helper ``Content.from_stream`` makes it easier to attach
- file-like objects to a test. (Jonathan Lange, #694126)
+* New content helpers ``Content.from_file`` and ``Content.from_stream`` make
+ it easier to attach file-like objects to a test. (Jonathan Lange, #694126)
* Vastly improved and extended documentation. (Jonathan Lange)
diff --git a/doc/for-test-authors.rst b/doc/for-test-authors.rst
index 6e5d3b2..45d4533 100644
--- a/doc/for-test-authors.rst
+++ b/doc/for-test-authors.rst
@@ -634,12 +634,16 @@ do::
Because adding small bits of text content is very common, there's also a
convenience method::
- text = text_content("some text")
+ text = Content.from_text("some text")
To make content out of an image stored on disk, you could do something like::
image = Content(ContentType('image', 'png'), lambda: open('foo.png').read())
+Or you could use the convenience method::
+
+ image = Content.from_file('foo.png', ContentType('image', 'png'))
+
The ``lambda`` helps make sure that the file is opened and the actual bytes
read only when they are needed – by default, when the test is finished. This
means that tests can construct and add Content objects freely without worrying