[CMF-checkins] CVS: CMF - test_Document.py:1.10
tseaver@digicool.com
tseaver@digicool.com
Tue, 5 Jun 2001 14:23:54 -0400 (EDT)
Update of /cvs-repository/CMF/CMFDefault/tests
In directory korak.digicool.com:/tmp/cvs-serv8849/tests
Modified Files:
test_Document.py
Log Message:
- Don't overwrite Subject when no 'Subject' or 'Keywords' headers
were present (Tracker #294).
--- Updated File test_Document.py in package CMF --
--- test_Document.py 2001/06/04 19:06:52 1.9
+++ test_Document.py 2001/06/05 18:23:53 1.10
@@ -63,6 +63,13 @@
All in favor say pi!
"""
+STX_NO_HEADERS = """\
+Title Phrase
+
+ This is a "plain" STX file, with no headers. Saving with
+ it shouldn't overwrite any metadata.
+"""
+
class DocumentTests(unittest.TestCase):
def test_Empty(self):
@@ -191,6 +198,28 @@
assert d.text == ''
assert d.title == 'Foodoc'
assert d.Format() == 'text/plain'
+
+ def test_STX_NoHeaders( self ):
+ d = Document('foo')
+ d._editMetadata( title="Plain STX"
+ , description="Look, Ma, no headers!"
+ , subject=( "plain", "STX" )
+ )
+ assert d.Format() == 'text/html'
+ assert d.Title() == 'Plain STX'
+ assert d.Description() == 'Look, Ma, no headers!'
+ assert len( d.Subject() ) == 2
+ assert 'plain' in d.Subject()
+ assert 'STX' in d.Subject()
+
+ d.edit(text_format='structured-text', text=STX_NO_HEADERS)
+
+ assert d.Format() == 'text/plain'
+ assert d.Title() == 'Plain STX'
+ assert d.Description() == 'Look, Ma, no headers!'
+ assert len( d.Subject() ) == 2
+ assert 'plain' in d.Subject()
+ assert 'STX' in d.Subject()
class TestDocumentPUT(unittest.TestCase):