1 | from Products.PloneTestCase import PloneTestCase as PloneTestCase |
---|
2 | |
---|
3 | from Products.CMFCore.utils import getToolByName |
---|
4 | from Products.Five.testbrowser import Browser |
---|
5 | |
---|
6 | from Products.qPingTool import PingTool |
---|
7 | from Products.qPingTool.config import * |
---|
8 | |
---|
9 | PRODUCTS = ['qPingTool', 'Quills'] |
---|
10 | |
---|
11 | map(PloneTestCase.installProduct, ('qPingTool', 'XMLRPCMethod', 'Quills')) |
---|
12 | |
---|
13 | PloneTestCase.setupPloneSite(products=PRODUCTS) |
---|
14 | |
---|
15 | class TestCase(PloneTestCase.PloneTestCase): |
---|
16 | """Base class used for test cases |
---|
17 | """ |
---|
18 | |
---|
19 | class FunctionalTestCase(PloneTestCase.FunctionalTestCase): |
---|
20 | """Test case class used for functional (doc-)tests |
---|
21 | """ |
---|
22 | |
---|
23 | def afterSetUp(self): |
---|
24 | super(FunctionalTestCase, self).afterSetUp() |
---|
25 | |
---|
26 | self.browser = Browser() |
---|
27 | |
---|
28 | self.uf = self.portal.acl_users |
---|
29 | self.uf.userFolderAddUser('root', 'secret', ['Manager'], []) |
---|
30 | |
---|
31 | self.ptool = getToolByName(self.portal, 'portal_properties') |
---|
32 | self.pitool = getToolByName(self.ptool, 'portal_pingtool') |
---|
33 | self.site_props = self.ptool.site_properties |
---|
34 | |
---|
35 | def loginAsManager(self, user='root', pwd='secret'): |
---|
36 | """points the browser to the login screen and logs in as user root with Manager role.""" |
---|
37 | self.browser.open('http://nohost/plone/') |
---|
38 | self.browser.getLink('Log in').click() |
---|
39 | self.browser.getControl('Login Name').value = user |
---|
40 | self.browser.getControl('Password').value = pwd |
---|
41 | self.browser.getControl('Log in').click() |
---|
42 | |
---|