[Zope3-checkins] CVS: Products3/z3checkins/ftests - __init__.py:1.1 msg1.txt:1.1 msg2.txt:1.1 test_z3checkins.py:1.1

Marius Gedminas mgedmin@codeworks.lt
Fri, 1 Aug 2003 05:43:26 -0400


Update of /cvs-repository/Products3/z3checkins/ftests
In directory cvs.zope.org:/tmp/cvs-serv820/ftests

Added Files:
	__init__.py msg1.txt msg2.txt test_z3checkins.py 
Log Message:
It is now possible to add regular email messages to z3checkins.  Unfortunately
this breaks backwards compatibility with old pickles.



=== Added File Products3/z3checkins/ftests/__init__.py ===
"""
Functional tests for z3checkins.

$Id: __init__.py,v 1.1 2003/08/01 09:43:20 mgedmin Exp $
"""


=== Added File Products3/z3checkins/ftests/msg1.txt ===
From: Jim <jim@example.org>
To: zope3-checkins@example.com
Date: Wed, 30 Jul 2003 23:40:11 +0100
Subject: [Zope3-checkins] CVS: Zope3/src/app/frobulator - frobulator.py:1.5
Message-Id: <msg1@example.org>

Update of /cvs-repository/Zope3/src/app/frobulator
In directory cvs.zope.org:/tmp/cvs-serv12345

Modified files:
        frobulator.py
Log message:
Update the frobulator time conductor API implementation to match the new
specification.


=== Zope3/src/app/frobulator/frobulator.py 1.4 => 1.5 ===
--- Zope3/src/app/frobulator/frobulator.py:1.4    Tue Mar 25 15:21:29 2003
+++ Zope3/src/app/frobulator/frobulator.py        Fri Mar 28 11:57:34 2003
@@@ -123,7 +123,7 @@
         z = self._transponder_matrix[0][3] ** 0.5 + epsilon
         return self.postprocessCochraneCoefficients(x, y, z)
 
-    def performTimeTravel(self, duration):
+    def performTimeTravel(self, duration, avoidParadoxes=True):
         """
         The basic time travel function.
 


_______________________________________________
Zope3-Checkins mailing list
Zope3-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope3-checkins


=== Added File Products3/z3checkins/ftests/msg2.txt ===
From: Fred <fred@example.org>
To: zope3-checkins@example.com
Date: Thu, 31 Jul 2003 17:00:23 +0300
Subject: Re: your checkin on Wednesday
Message-Id: <msg2@example.org>
In-Reply-To: <msg1@example.org>

I did not particuarily understand the change to frobulator.py regarding the
superconducting time traveller specification.  It looks like you omitted at
least a part of the implementation.  Could you double check?

-- 
Fred


=== Added File Products3/z3checkins/ftests/test_z3checkins.py ===
#!/usr/bin/python
"""
Functional tests for z3checkins.

$Id: test_z3checkins.py,v 1.1 2003/08/01 09:43:20 mgedmin Exp $
"""

import unittest
import os
from zope.testing.functional import BrowserTestCase

class TestCheckins(BrowserTestCase):

    container_views = ('index.html', 'checkins.html',
                       'checkins-sidebar.html', 'checkins.rss')
    message_views = ('index.html', 'index.txt')
    resources = ('zope3.png', 'product.png', 'branch.png', 'message.png')

    def open(self, filename):
        """Open a file relative to the location of this module."""
        base = os.path.dirname(__file__)
        return open(os.path.join(base, filename))

    def setUp(self):
        BrowserTestCase.setUp(self)
        response = self.publish('/+/action.html',
                                basic='mgr:mgrpw',
                                form={'type_name': u'Folder', 'id': u'z3c'})
        self.assertEqual(response.getStatus(), 302)

    def test_empty(self):
        for view in self.container_views:
            response = self.publish('/z3c/@@%s' % view)
            self.assertEqual(response.getStatus(), 200)

    def test_resources(self):
        for resource in self.resources:
            response = self.publish('/z3c/@@/%s' % resource)
            self.assertEqual(response.getStatus(), 200)

    def test_add_checkin_message(self):
        response = self.publish('/z3c/+/CheckinMessage',
                                basic='mgr:mgrpw',
                                form={'field.data': self.open('msg1.txt'),
                                      'UPDATE_SUBMIT': u'Submit'})
        self.assertEqual(response.getStatus(), 302)

        for view in self.container_views:
            response = self.publish('/z3c/@@%s' % view)
            self.assertEqual(response.getStatus(), 200)
        for view in self.message_views:
            response = self.publish('/z3c/<msg1@example.org>/@@%s' % view)
            self.assertEqual(response.getStatus(), 200)

        response = self.publish('/z3c/@@checkins.rss')
        self.assertEqual(response.getStatus(), 200)
        body = response.getBody()
        xml_directive = '<?xml '
        self.assert_(body.startswith(xml_directive),
                     'checkins.rss has no XML directive:\n%s...' % body[:70])
        # Make sure the XML directive is not repeated
        self.assert_(body[len(xml_directive):].find(xml_directive) == -1,
                     '%s appears more than once in checkins.rss' % xml_directive)

    def test_add_simple_message(self):
        response = self.publish('/z3c/+/CheckinMessage',
                                basic='mgr:mgrpw',
                                form={'field.data': self.open('msg2.txt'),
                                      'UPDATE_SUBMIT': u'Submit'})
        self.assertEqual(response.getStatus(), 302)

        for view in self.container_views:
            response = self.publish('/z3c/@@%s' % view)
            self.assertEqual(response.getStatus(), 200)
        for view in self.message_views:
            response = self.publish('/z3c/<msg2@example.org>/@@%s' % view)
            self.assertEqual(response.getStatus(), 200)

        response = self.publish('/z3c/@@checkins.rss')
        self.assertEqual(response.getStatus(), 200)
        body = response.getBody()
        xml_directive = '<?xml '
        self.assert_(body.startswith(xml_directive),
                     'checkins.rss has no XML directive:\n%s...' % body[:70])
        # Make sure the XML directive is not repeated
        self.assert_(body[len(xml_directive):].find(xml_directive) == -1,
                     '%s appears more than once in checkins.rss' % xml_directive)



def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestCheckins))
    return suite


if __name__ == '__main__':
    unittest.main()