[205] | 1 | import unittest |
---|
| 2 | from zope.testing import doctestunit |
---|
| 3 | from Testing.ZopeTestCase import FunctionalDocFileSuite as FileSuite |
---|
| 4 | |
---|
| 5 | from zope.app.tests.placelesssetup import setUp, tearDown |
---|
| 6 | from Products.PloneTestCase import PloneTestCase as PloneTestCase |
---|
| 7 | |
---|
| 8 | class FunctionalTestCase(PloneTestCase.FunctionalTestCase): |
---|
| 9 | """Test case class used for functional (doc-)tests |
---|
| 10 | """ |
---|
| 11 | |
---|
| 12 | def afterSetUp(self): |
---|
| 13 | super(FunctionalTestCase, self).afterSetUp() |
---|
| 14 | |
---|
| 15 | self.uf = self.portal.acl_users |
---|
| 16 | self.uf.userFolderAddUser('root', 'secret', ['Manager'], []) |
---|
| 17 | |
---|
| 18 | def loginAsManager(self, user='root', pwd='secret'): |
---|
| 19 | """points the browser to the login screen and logs in as user root with Manager role.""" |
---|
| 20 | self.basic_auth = '%s:%s' % (user, pwd) |
---|
| 21 | self.login('root') |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | def test_suite(): |
---|
| 25 | return unittest.TestSuite([ |
---|
| 26 | |
---|
| 27 | doctestunit.DocTestSuite( |
---|
| 28 | module='Products.qPingTool.adapter', |
---|
| 29 | setUp=setUp, tearDown=tearDown), |
---|
| 30 | |
---|
| 31 | FileSuite( |
---|
| 32 | 'browser.txt', package='Products.qPingTool.tests', |
---|
| 33 | test_class=FunctionalTestCase,), |
---|
| 34 | |
---|
| 35 | ]) |
---|
| 36 | |
---|
| 37 | if __name__ == '__main__': |
---|
| 38 | unittest.main(defaultTest='test_suite') |
---|