[qmtest] [PATCH] fix attachments
Mark Mitchell
mark at codesourcery.com
Mon Jul 21 20:42:02 UTC 2003
On Thu, 2003-07-17 at 05:01, Vladimir Prus wrote:
>
> There wes a typo.
Indeed.
I bit the bullet and created a test case to make sure that we have
*some* basic testing for attachments in our testsuite.
Thanks for the patch!
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
-------------- next part --------------
2003-07-21 Vladimir Prus <ghost at cs.msu.su>
Mark Mitchell <mark at codesourcery.com>
* qm/attachment.py (FileAttachmentStore.GetDataFile): Fix typo.
* tests/regress/attachment1/attachment1: New file.
* tests/regress/attachment1/results.qmr: Likewise.
* tests/regress/attachment1/test.qmt: Likewise.
* tests/regress/attachment1/QMTest/.cvsignore: Likewise.
* tests/regress/attachment1/QMTest/attachment_test.py: Likewise.
* tests/regress/attachment1/QMTest/classes.qmc: Likewise.
Index: qm/attachment.py
===================================================================
RCS file: /home/sc/Repository/qm/qm/attachment.py,v
retrieving revision 1.19
diff -c -5 -p -r1.19 attachment.py
*** qm/attachment.py 15 Jul 2003 18:48:21 -0000 1.19
--- qm/attachment.py 21 Jul 2003 19:35:36 -0000
*************** class FileAttachmentStore(AttachmentStor
*** 275,286 ****
return s
def GetDataFile(self, location):
! if root is not None:
! return os.path.join(root, location)
else:
return location
def GetSize(self, location):
--- 275,286 ----
return s
def GetDataFile(self, location):
! if self.__root is not None:
! return os.path.join(self.__root, location)
else:
return location
def GetSize(self, location):
Index: tests/regress/attachment1/attachment1
===================================================================
RCS file: tests/regress/attachment1/attachment1
diff -N tests/regress/attachment1/attachment1
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/attachment1 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1 ----
+ The quick brown fox jumped over the lazy dog.
Index: tests/regress/attachment1/results.qmr
===================================================================
RCS file: tests/regress/attachment1/results.qmr
diff -N tests/regress/attachment1/results.qmr
Binary files /dev/null and results.qmr differ
Index: tests/regress/attachment1/test1.qmt
===================================================================
RCS file: tests/regress/attachment1/test1.qmt
diff -N tests/regress/attachment1/test1.qmt
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/test1.qmt 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1,2 ----
+ <?xml version="1.0" ?>
+ <extension class="attachment_test.AttachmentTest" kind="test"><argument name="prerequisites"><set/></argument><argument name="target_group"><text>.*</text></argument><argument name="attachment"><attachment><description>attachment1</description><mime-type>application/octet-stream</mime-type><filename>attachment1</filename><location>attachment1</location></attachment></argument><argument name="resources"><set/></argument></extension>
Index: tests/regress/attachment1/QMTest/.cvsignore
===================================================================
RCS file: tests/regress/attachment1/QMTest/.cvsignore
diff -N tests/regress/attachment1/QMTest/.cvsignore
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/QMTest/.cvsignore 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1,3 ----
+ *.pyc
+ *.pyo
+
Index: tests/regress/attachment1/QMTest/attachment_test.py
===================================================================
RCS file: tests/regress/attachment1/QMTest/attachment_test.py
diff -N tests/regress/attachment1/QMTest/attachment_test.py
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/QMTest/attachment_test.py 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1,43 ----
+ ########################################################################
+ #
+ # File: attachment_test.py
+ # Author: Mark Mitchell
+ # Date: 2003-07-21
+ #
+ # Contents:
+ # Test classes for tests written in Python.
+ #
+ # Copyright (c) 2003 by CodeSourcery, LLC. All rights reserved.
+ #
+ # For license terms see the file COPYING.
+ #
+ ########################################################################
+
+ ########################################################################
+ # Imports
+ ########################################################################
+
+ import qm.fields
+ from qm.test.test import Test
+
+ ########################################################################
+ # Classes
+ ########################################################################
+
+ class AttachmentTest(Test):
+ """An 'AttachmentTest' has a single attachment.
+
+ This test class is used to validate QMTest's attachment processing."""
+
+ arguments = [
+ qm.fields.AttachmentField(
+ name="attachment"
+ )
+ ]
+
+
+ def Run(self, context, result):
+
+ if (self.attachment.GetData()
+ != "The quick brown fox jumped over the lazy dog.\n"):
+ result.Fail("Incorrect attachment contents.")
Index: tests/regress/attachment1/QMTest/classes.qmc
===================================================================
RCS file: tests/regress/attachment1/QMTest/classes.qmc
diff -N tests/regress/attachment1/QMTest/classes.qmc
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/QMTest/classes.qmc 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1,2 ----
+ <?xml version="1.0" ?>
+ <class-directory><class kind="test">attachment_test.AttachmentTest</class></class-directory>
\ No newline at end of file
Index: tests/regress/attachment1/QMTest/configuration
===================================================================
RCS file: tests/regress/attachment1/QMTest/configuration
diff -N tests/regress/attachment1/QMTest/configuration
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- tests/regress/attachment1/QMTest/configuration 21 Jul 2003 19:35:36 -0000
***************
*** 0 ****
--- 1,2 ----
+ <?xml version="1.0" ?>
+ <extension class="xml_database.XMLDatabase" kind="database"/>
\ No newline at end of file
More information about the qmtest
mailing list