/usr/share/pyshared/zope/app/generations/browser/tests.py is in python-zope.app.generations 3.6.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Generation-browser tests
$Id: tests.py 124134 2012-01-23 15:20:44Z menesis $
"""
import unittest
import doctest
from zope.app.generations.testing import GenerationsLayer
from zope.app.testing import ztapi, functional
from zope.app.generations.generations import SchemaManager, generations_key
from zope.app.generations.interfaces import ISchemaManager
class TestDatabaseSchema(functional.BrowserTestCase):
def test(self):
root = self.getRootFolder()._p_jar.root()
appkey = 'zope.app.generations.demo'
root[generations_key][appkey] = 0
self.commit()
manager = SchemaManager(0, 3, 'zope.app.generations.demo')
ztapi.provideUtility(ISchemaManager, manager, appkey)
response = self.publish('/++etc++process/@@generations.html',
basic='globalmgr:globalmgrpw')
body = response.getBody()
body = ' '.join(body.split())
expect = ('zope.app.generations.demo</a> </td> '
'<td>0</td> <td>3</td> <td>0</td> '
'<td> <input type="submit" value=" evolve " '
'name="evolve-app-zope.app.generations.demo"> </td>')
self.assert_(body.find(expect) > 0)
response = self.publish('/++etc++process/@@generations.html'
'?evolve-app-zope.app.generations.demo=evolve',
basic='globalmgr:globalmgrpw')
body = response.getBody()
body = ' '.join(body.split())
expect = ('zope.app.generations.demo</a> </td> '
'<td>0</td> <td>3</td> <td>1</td> '
'<td> <input type="submit" value=" evolve " '
'name="evolve-app-zope.app.generations.demo"> </td>')
self.assert_(body.find(expect) > 0)
response = self.publish('/++etc++process/@@generations.html'
'?evolve-app-zope.app.generations.demo=evolve',
basic='globalmgr:globalmgrpw')
body = response.getBody()
body = ' '.join(body.split())
expect = ('zope.app.generations.demo</a> </td> '
'<td>0</td> <td>3</td> <td>2</td> '
'<td> <input type="submit" value=" evolve " '
'name="evolve-app-zope.app.generations.demo"> </td>')
self.assert_(body.find(expect) > 0)
response = self.publish('/++etc++process/@@generations.html'
'?evolve-app-zope.app.generations.demo=evolve',
basic='globalmgr:globalmgrpw')
body = response.getBody()
body = ' '.join(body.split())
expect = ('zope.app.generations.demo</a> </td> '
'<td>0</td> <td>3</td> <td>3</td> '
'<td> <span>')
self.assert_(body.find(expect) > 0)
ztapi.unprovideUtility(ISchemaManager, appkey)
def test_suite():
TestDatabaseSchema.layer = GenerationsLayer
return unittest.TestSuite((
doctest.DocTestSuite('zope.app.generations.browser.managers'),
doctest.DocTestSuite('zope.app.generations.browser.managerdetails'),
unittest.makeSuite(TestDatabaseSchema),
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
|