source: trunk/tests/testUsers.py @ 1930

Revision 1930, 2.1 KB checked in by jukka, 12 years ago (diff)

Fixed tests and other stuff, fixed #1376, closed #1420.

  • Property svn:eol-style set to native
RevLine 
[236]1# Copyright 2006 by the LeMill Team (see AUTHORS)
[99]2#
[236]3# This file is part of LeMill.
[99]4#
[236]5# LeMill is free software; you can redistribute it and/or modify
[99]6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
[236]10# LeMill is distributed in the hope that it will be useful,
[99]11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
[236]16# along with LeMill; if not, write to the Free Software
[99]17# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
[28]19import os, sys, re
20if __name__ == '__main__':
21    execfile(os.path.join(sys.path[0], 'framework.py'))
22
23from Testing import ZopeTestCase
[236]24from LeMillTestCase import LeMillTestCase
[28]25from Testing.ZopeTestCase.functional import Functional
26
[236]27from Products.LeMill.config import *
[115]28from Products.PloneTestCase.setup import portal_owner, default_password
[28]29
[115]30auth=':'.join((portal_owner, default_password))
[28]31
[236]32class TestUsers(LeMillTestCase,Functional):
[28]33    """
34    Test suite for verifying user functionality.
35    """
36
37    def testUserProperties(self):
[230]38        for prop in MEMBER_PROPERTIES:
[127]39            self.failUnless(self.portal.portal_memberdata.hasProperty(prop[0]),"Property %s not found in user data: %s" % (prop,str(self.portal.portal_memberdata.propertyItems())))
[28]40
[230]41
[115]42    def testPersonalizeForm(self):
[230]43        self.addUser('test1','passwd1')
44        auth="test1:passwd1"
45        self.login('test1')
[1930]46        result=self.publish(self.portal.absolute_url_path()+'/community/test1/personalize_form', basic=auth)
[230]47        body=result.getBody()
48        for prop in MEMBER_PROPERTIES:
49            if not prop[2]=="hidden":
[1624]50                self.failUnless(body.find(prop[0]) != -1, "personalize_form broken, property %s not found" % prop[0] + body)
[1222]51     
[33]52
[28]53def test_suite():
54    from unittest import TestSuite, makeSuite
55    suite = TestSuite()
56    suite.addTest(makeSuite(TestUsers))
57    return suite
58
59if __name__ == '__main__':
60    framework()
Note: See TracBrowser for help on using the repository browser.