Changeset 1126

Show
Ignore:
Timestamp:
06/27/08 09:35:15
Author:
deo
Message:

Modernized tests. Untabify.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneComments/branches/plone-3.0/tests/helperNotify.py

    r1018 r1126  
    55import sys 
    66import os, os.path 
    7 from Products.MailHost.MailHost import MailBase 
    8 ver = "2.0.5" 
    9 try: 
    10     from Products.SecureMailHost.SecureMailHost import SecureMailBase 
    11     ver = "2.1" 
    12 except ImportError: 
    13     pass 
     7from Products.SecureMailHost.SecureMailHost import SecureMailBase 
    148 
    159PREFIX = os.path.abspath(os.path.dirname(__file__)) 
     
    6155 
    6256def prepareMailSendTest(): 
    63     # patch MailHost 
    64     MailBase._send = _send_MH 
    65     if ver == "2.1": 
    66         # patch SecureMailHost 
    67         SecureMailBase.send = send_SMH 
    68         SecureMailBase._send = _send_SMH 
     57    # patch SecureMailHost 
     58    SecureMailBase.send = send_SMH 
     59    SecureMailBase._send = _send_SMH 
    6960 
    7061def setProperties(prop_sheet, *props): 
     
    7970 
    8071def getMails(): 
    81     return [file(output_file_path(f),'r').read() for f in os.listdir(output_file_path("")) if f.startswith('mail')] 
    82  
     72    return [file(output_file_path(f),'r').read() 
     73            for f in os.listdir(output_file_path("")) 
     74            if f.startswith('mail')] 
    8375 
    8476def cleanOutputDir(): 
    8577    for f in os.listdir(output_file_path("")): 
    86         if f.startswith('mail'): os.remove(output_file_path(f)) 
     78        if f.startswith('mail'): 
     79            os.remove(output_file_path(f)) 
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsCommenting.py

    r1018 r1126  
    33# 
    44 
    5 import os, sys, string 
    6 if __name__ == '__main__': 
    7     execfile(os.path.join(sys.path[0], 'framework.py')) 
    8  
    95from Products.PloneTestCase import PloneTestCase 
    106from Products.CMFCore.utils import getToolByName 
    117from zExceptions import Unauthorized 
    12 import re 
    138 
    149PRODUCT = 'qPloneComments' 
     
    4742        for user_id in USERS.keys(): 
    4843            self.membership.addMember(user_id, USERS[user_id]['passw'] , USERS[user_id]['roles'], []) 
    49          
     44 
    5045        # Add users to Discussion Manager group 
    5146        portal_groups = getToolByName(self.portal, 'portal_groups') 
     
    298293        self.discussion.getDiscussionFor(doc_obj) 
    299294        doc_obj.discussion_reply("A Reply to '%s'" % self.doc_moder_off_id,"text of reply to '%s'" % self.doc_moder_off_id) 
    300              
     295 
    301296 
    302297    def testAddCommentToReplyAllowableUsers(self): 
     
    346341        TestCommBase.afterSetUp(self) 
    347342        # Preparation for functional testing 
    348         # Tern On Moderation and tern on Anonymous commenting  
     343        # Tern On Moderation and tern on Anonymous commenting 
    349344        self.request.form['enable_anonymous_commenting'] = 'True' 
    350345        self.request.form['enable_moderation'] = 'True' 
     
    360355        TestCommBase.afterSetUp(self) 
    361356        # Preparation for functional testing 
    362         # Tern On Moderation and tern off Anonymous commenting  
     357        # Tern On Moderation and tern off Anonymous commenting 
    363358        self.request.form['enable_moderation'] = 'True' 
    364359        self.portal.prefs_comments_setup() 
     
    366361        TestMixinAnonymOff.afterSetUp(self) 
    367362        TestMixinModerationOn.afterSetUp(self) 
    368  
    369363 
    370364 
     
    387381        TestCommBase.afterSetUp(self) 
    388382        # Preparation for functional testing 
    389         # Tern Off Moderation and tern off Anonymous commenting  
     383        # Tern Off Moderation and tern off Anonymous commenting 
    390384        self.portal.prefs_comments_setup() 
    391385        # Initialize base classes 
     
    393387        TestMixinModerationOff.afterSetUp(self) 
    394388 
    395      
    396  
    397 TESTS = [TestModerationAnonymComm, TestModerationOFFAnonymComm, TestAnonymCommOFFModeration, TestOFFModerationOFFAnonymComm] 
    398389 
    399390def test_suite(): 
     
    406397 
    407398    return suite 
    408  
    409 if __name__ == '__main__': 
    410     framework() 
    411  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsConfiglet.py

    r1018 r1126  
    33# 
    44 
    5 import os, sys, string 
    6 if __name__ == '__main__': 
    7     execfile(os.path.join(sys.path[0], 'framework.py')) 
    8  
    95from Products.PloneTestCase import PloneTestCase 
    106from Products.CMFCore.utils import getToolByName 
    11 try: 
    12     from Products.CMFCore.permissions import ManagePortal, ReplyToItem 
    13 except ImportError: 
    14     from Products.CMFCore.CMFCorePermissions import ManagePortal,ReplyToItem 
    15 from Products.MailHost.MailHost import MailBase 
     7from Products.CMFCore.permissions import ReplyToItem 
    168from AccessControl.SecurityManagement import noSecurityManager 
    179 
     
    3729PloneTestCase.setupPloneSite() 
    3830 
    39  
    4031def addUsers(self): 
    4132    self.loginAsPortalOwner() 
     
    4435    for user_id in USERS.keys(): 
    4536        self.membership.addMember(user_id, USERS[user_id]['passw'] , USERS[user_id]['roles'], []) 
    46      
     37 
    4738    # Add users to Discussion Manager group 
    4839    portal_groups = getToolByName(self.portal, 'portal_groups') 
     
    6657        doc_fti = portal_types.getTypeInfo('Document') 
    6758        doc_fti._updateProperty('allow_discussion', 1) 
    68          
     59 
    6960        # Make sure Documents are visible by default 
    7061        # XXX only do this for plone 3 
     
    8778        member.setMemberProperties({'email':'creator@test.com'}) 
    8879        #self.fail(member.getMemberId()+' :: '+member.getUserName()+' :: '+str(member.getRoles())+' :: '+member.getProperty('email')) 
    89          
     80 
    9081        # Add testing document to portal 
    9182        my_doc = self.portal.invokeFactory('Document', id='my_doc') 
    9283        self.my_doc = self.portal['my_doc'] 
    9384        self.my_doc.edit(text_format='plain', text='hello world') 
    94  
    9585 
    9686    def testAnonymousCommenting(self): 
     
    111101        self.assert_(not 'Anonymous' in actual_reply_permission, \ 
    112102                     "'Reply to Item' permission set for %s. 'Anonymous' role NOT erased" %  actual_reply_permission) 
    113  
    114103 
    115104    def testSwitchONModeration(self): 
     
    137126            self.assert_(not getReplies(), "Viewing discussion item allow for Anonymous user") 
    138127 
    139  
    140128    def testSwitchOFFModeration(self): 
    141129        addUsers(self) 
     
    159147            self.assert_(replies, "No discussion item added or discussion forbidden for %s user" % u) 
    160148 
    161  
    162149    def testApproveNotification(self): 
    163150        # Check ON Notification Anonymous Commenting 
     
    171158        self.portal.prefs_comments_setup() 
    172159        self.assert_(self.prefs.getProperty('enable_approve_notification')==0,"Approve Notification not terned OFF") 
    173  
    174160 
    175161    def testPublishedNotification(self): 
     
    186172 
    187173 
    188  
    189 TESTS = [TestConfiglet] 
    190  
    191174def test_suite(): 
    192175    from unittest import TestSuite, makeSuite 
     
    194177    suite.addTest(makeSuite(TestConfiglet)) 
    195178    return suite 
    196  
    197 if __name__ == '__main__': 
    198     framework() 
    199  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsInstall.py

    r1018 r1126  
    22# Test product's installation/uninstallation 
    33# 
    4  
    5 import os, sys, string 
    6 if __name__ == '__main__': 
    7     execfile(os.path.join(sys.path[0], 'framework.py')) 
    84 
    95from Products.PloneTestCase import PloneTestCase 
     
    3127    def afterSetUp(self): 
    3228        self.loginAsPortalOwner() 
    33  
    3429        self.qi = self.portal.portal_quickinstaller 
    3530        self.qi.installProduct(PRODUCT) 
     
    4035 
    4136    def test_skins_install(self): 
    42         skinstool=getToolByName(self.portal, 'portal_skins')  
    43  
     37        skinstool=getToolByName(self.portal, 'portal_skins') 
    4438        for skin in skinstool.getSkinSelections(): 
    4539            path = skinstool.getSkinPath(skin) 
    46             path = map( string.strip, string.split( path,',' )
     40            path = map(str.strip, path.split(',')
    4741            self.assert_(PRODUCT_SKIN_NAME in path, 'qPloneComments layer not found in %s' % skin) 
    4842 
     
    5145        from Products.qPloneComments.interfaces import IPloneCommentsLayer 
    5246        self.failUnless(IPloneCommentsLayer in registered_layers()) 
    53  
    54     #def test_versionedskin_install(self): 
    55     #    skinstool=getToolByName(self.portal, 'portal_skins') 
    56     #    mtool = getToolByName(self.portal, 'portal_migration') 
    57     #    plone_version = mtool.getFileSystemVersion() 
    58     # 
    59     #    for skin in skinstool.getSkinSelections(): 
    60     #        path = skinstool.getSkinPath(skin) 
    61     #        path = map( string.strip, string.split( path,',' ) ) 
    62     #        self.assert_(PRODUCT+'/%s' % plone_version in path, 'qSEOptimizer versioned layer not found in %s' %skin) 
    6347 
    6448    def test_propertysheet_install(self): 
     
    7458        self.assert_(ANONYMOUS_COMMENTING_PID in property_ids, '%s propery not found in %s property' % (ANONYMOUS_COMMENTING_PID, PROPERTY_SHEET)) 
    7559 
    76  
    7760    def test_skins_uninstall(self): 
    7861        self.qi.uninstallProducts([PRODUCT]) 
    7962        self.assertNotEqual(self.qi.isProductInstalled(PRODUCT), True,'qPloneComments is already installed') 
    80         skinstool=getToolByName(self.portal, 'portal_skins')  
     63        skinstool=getToolByName(self.portal, 'portal_skins') 
    8164 
    8265        #self.assert_(not PRODUCT_SKIN_NAME in skinstool.objectIds(), '%s directory view found in portal_skins after uninstallation' % PRODUCT_SKIN_NAME) 
    8366        for skin in skinstool.getSkinSelections(): 
    8467            path = skinstool.getSkinPath(skin) 
    85             path = map( string.strip, string.split( path,',' )
     68            path = map(str.strip, path.split(',')
    8669            self.assert_(not PRODUCT_SKIN_NAME in path, '%s layer found in %s after uninstallation' % (PRODUCT_SKIN_NAME, skin)) 
    8770 
     
    8972        self.qi.uninstallProducts([PRODUCT]) 
    9073        self.assertNotEqual(self.qi.isProductInstalled(PRODUCT), True,'qPloneComments is already installed') 
    91          
     74 
    9275        from plone.browserlayer.utils import registered_layers 
    9376        from Products.qPloneComments.interfaces import IPloneCommentsLayer 
    9477        self.failIf(IPloneCommentsLayer in registered_layers()) 
    9578 
    96     #def test_versionedskin_uninstall(self): 
    97     #    self.qi.uninstallProducts([PRODUCT]) 
    98     #    self.assertNotEqual(self.qi.isProductInstalled(PRODUCT), True,'qSEOptimizer is already installed') 
    99     #    skinstool=getToolByName(self.portal, 'portal_skins') 
    100     #    mtool = getToolByName(self.portal, 'portal_migration') 
    101     #    plone_version = mtool.getFileSystemVersion() 
    102     # 
    103     #    for skin in skinstool.getSkinSelections(): 
    104     #        path = skinstool.getSkinPath(skin) 
    105     #        path = map( string.strip, string.split( path,',' ) ) 
    106     #        self.assert_(not PRODUCT+'/%s' % plone_version in path, 'qSEOptimizer versioned layer found in %s after uninstallation' %skin) 
    107  
    10879    def test_configlet_uninstall(self): 
    10980        self.qi.uninstallProducts([PRODUCT]) 
    11081        self.assertNotEqual(self.qi.isProductInstalled(PRODUCT), True,'qPloneComments is already installed') 
    111      
     82 
    11283        configTool = getToolByName(self.portal, 'portal_controlpanel', None) 
    11384        self.assert_(not CONFIGLET_ID in [a.getId() for a in configTool.listActions()], 'Configlet found after uninstallation') 
     
    11687        self.qi.uninstallProducts([PRODUCT]) 
    11788        self.assertNotEqual(self.qi.isProductInstalled(PRODUCT), True,'qPloneComments is already installed') 
    118          
     89 
    11990        portal_properties = getToolByName(self.portal, 'portal_properties') 
    12091        self.assert_(PROPERTY_SHEET in portal_properties.objectIds(), \ 
    12192                     'qPloneComments property_sheet not found in portal_properties after uninstallation') 
    122      
     93 
    12394    def test_permission_added(self): 
    124         roles = [item['name'] for item in self.portal.rolesOfPermission(PERM_NAME)] 
    125         self.assert_( roles != [], '%s not installed'%PERM_NAME) 
    126          
     95        roles = [item['name'] for item in self.portal.rolesOfPermission(PERM_NAME)] 
     96        self.assert_( roles != [], '%s not installed'%PERM_NAME) 
    12797 
    128 TESTS = [TestInstallation] 
    12998 
    13099def test_suite(): 
     
    133102    suite.addTest(makeSuite(TestInstallation)) 
    134103    return suite 
    135  
    136 if __name__ == '__main__': 
    137     framework() 
    138  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsModeration.py

    r1018 r1126  
    33# 
    44 
    5 import os, sys, string 
    6 if __name__ == '__main__': 
    7     execfile(os.path.join(sys.path[0], 'framework.py')) 
    8  
    95from Products.PloneTestCase import PloneTestCase 
    106from Products.CMFCore.utils import getToolByName 
     
    1511PloneTestCase.installProduct(PRODUCT) 
    1612PloneTestCase.setupPloneSite() 
     13 
    1714 
    1815class TestModeration(PloneTestCase.FunctionalTestCase): 
     
    3128        # Add all users 
    3229        addMembers(self.portal, USERS) 
    33              
     30 
    3431        # For correct testing notification - add 'portal_owner' with 'email' 
    3532        #self.membership.addMember('portal_owner', 'secret' , ['Manager'], []) 
     
    4037        # Add users to Discussion Manager group 
    4138        add2Group(self.portal, 'DiscussionManager', DM_USERS_IDS) 
    42          
     39 
    4340        #portal_groups = getToolByName(self.portal, 'portal_groups') 
    4441        ##portal_groups.addGroup('DiscussionManager', roles=['DiscussionManager']) 
     
    5047        doc_fti = portal_types.getTypeInfo('Document') 
    5148        doc_fti._updateProperty('allow_discussion', 1) 
    52          
     49 
    5350        # Make sure Documents are visible by default 
    5451        # XXX only do this for plone 3 
     
    8481        doc = getattr(self.portal, 'doc_%s' % DM_USERS_IDS[0]) 
    8582        roles = [r['name'] for r in self.portal.rolesOfPermission('Moderate Discussion') if r['selected'] == 'SELECTED'] 
    86        authorized_users = [user for user in COMMON_USERS_IDS if user !='anonym'] 
     83        authorized_users = [user for user in COMMON_USERS_IDS if user !='anonym'] 
    8784        users_without_md_perm = [u for u in authorized_users if filter(lambda x: x not in roles, USERS[u]['roles'])] 
    8885        for u in users_without_md_perm: 
     
    112109 
    113110    def testViewPublishButtonNonDMUsers(self): 
    114         # Publish button MUST BE ABSENT in document view form  
     111        # Publish button MUST BE ABSENT in document view form 
    115112        # Pattern for publish button presence checking 
    116113        if self.version.startswith("2.1"): 
     
    118115                                 re.S|re.M) 
    119116        elif self.version.startswith("2.5") or self.version.startswith('3.0'): 
    120            pattern = re.compile('.*<input.+?value="Publish"',\ 
    121                                  re.S|re.M) 
    122         else: 
    123            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish This Discussion"\\s*/>',\ 
    124                                  re.S|re.M) 
    125  
    126        roles = [r['name'] for r in self.portal.rolesOfPermission('Moderate Discussion') if r['selected'] == 'SELECTED'] 
    127        authorized_users = [user for user in COMMON_USERS_IDS if user !='anonym'] 
    128        users_without_md_perm = [u for u in authorized_users if filter(lambda x: x not in roles, USERS[u]['roles'])] 
     117            pattern = re.compile('.*<input.+?value="Publish"',\ 
     118                                 re.S|re.M) 
     119        else: 
     120            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish This Discussion"\\s*/>',\ 
     121                                 re.S|re.M) 
     122 
     123        roles = [r['name'] for r in self.portal.rolesOfPermission('Moderate Discussion') if r['selected'] == 'SELECTED'] 
     124        authorized_users = [user for user in COMMON_USERS_IDS if user !='anonym'] 
     125        users_without_md_perm = [u for u in authorized_users if filter(lambda x: x not in roles, USERS[u]['roles'])] 
    129126        for u in users_without_md_perm: 
    130127            self.logout() 
     
    145142                                 re.S|re.M) 
    146143        elif self.version.startswith("2.5") or self.version.startswith('3.0'): 
    147            pattern = re.compile('.*<input.+?value="Publish"',\ 
    148                                  re.S|re.M) 
    149         else: 
    150            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish"\\s*/>',\ 
     144            pattern = re.compile('.*<input.+?value="Publish"',\ 
     145                                 re.S|re.M) 
     146        else: 
     147            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish"\\s*/>',\ 
    151148                                 re.S|re.M) 
    152149        for u in DM_USERS_IDS: 
     
    167164                                 re.S|re.M) 
    168165        elif self.version.startswith("2.5") or self.version.startswith('3.0'): 
    169            pattern = re.compile('.*<input.+?value="Publish"',\ 
    170                                  re.S|re.M) 
    171         else: 
    172            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish This Discussion"\\s*/>',\ 
     166            pattern = re.compile('.*<input.+?value="Publish"',\ 
     167                                 re.S|re.M) 
     168        else: 
     169            pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish This Discussion"\\s*/>',\ 
    173170                                 re.S|re.M) 
    174171        for u in DM_USERS_IDS: 
     
    214211                                 re.S|re.M) 
    215212        elif self.version.startswith("2.5") or self.version.startswith('3.0'): 
    216            pattern = re.compile('.*<input\\s*class="destructive"\\s*type="submit"\\s*value="Remove"\\s*/>',\ 
    217                                  re.S|re.M) 
    218         else: 
    219            pattern = re.compile('.*<input\\s*class="destructive"\\s*type="submit"\\s*value="Remove"\\s*/>',\ 
     213            pattern = re.compile('.*<input\\s*class="destructive"\\s*type="submit"\\s*value="Remove"\\s*/>',\ 
     214                                 re.S|re.M) 
     215        else: 
     216            pattern = re.compile('.*<input\\s*class="destructive"\\s*type="submit"\\s*value="Remove"\\s*/>',\ 
    220217                                 re.S|re.M) 
    221218        for u in COMMON_USERS_IDS: 
     
    259256 
    260257 
    261 TESTS = [TestModeration] 
    262  
    263258def test_suite(): 
    264259    from unittest import TestSuite, makeSuite 
     
    266261    suite.addTest(makeSuite(TestModeration)) 
    267262    return suite 
    268  
    269 if __name__ == '__main__': 
    270     framework() 
    271  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsNotification.py

    r1018 r1126  
    1 #    
     1# 
    22# Test configuration form working 
    33# 
    44 
    5 import os, sys, string 
    6  
    7 if __name__ == '__main__': 
    8     execfile(os.path.join(sys.path[0], 'framework.py')) 
    9  
    105from Products.PloneTestCase import PloneTestCase 
    116from Products.CMFCore.utils import getToolByName 
    12 try: 
    13     from Products.CMFCore.permissions import ManagePortal, ReplyToItem 
    14 except ImportError: 
    15     from Products.CMFCore.CMFCorePermissions import ManagePortal,ReplyToItem 
    16 from Products.MailHost.MailHost import MailBase 
     7from Products.CMFCore.permissions import ManagePortal, ReplyToItem 
    178 
    189import re 
    19  
     10from helperNotify import * 
    2011from Products.qPloneComments.utils import getMsg 
    21 from helperNotify import * 
    2212 
    2313PRODUCT = 'qPloneComments' 
     
    4838        doc_fti = portal_types.getTypeInfo('Document') 
    4939        doc_fti._updateProperty('allow_discussion', 1) 
    50          
     40 
    5141        # Make sure Documents are visible by default 
    5242        # XXX only do this for plone 3 
     
    195185 
    196186 
    197     #def test_ 
    198  
    199 TESTS = [TestNotification] 
    200  
    201187def test_suite(): 
    202188    from unittest import TestSuite, makeSuite 
     
    204190    suite.addTest(makeSuite(TestNotification)) 
    205191    return suite 
    206  
    207 if __name__ == '__main__': 
    208     framework() 
    209  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsNotificationRecipients.py

    r1018 r1126  
    1 #    
     1# 
    22# Test configuration form working 
    33# 
    44 
    5 import os, sys, string 
    6  
    7 if __name__ == '__main__': 
    8     execfile(os.path.join(sys.path[0], 'framework.py')) 
    9  
    105from Products.PloneTestCase import PloneTestCase 
    116from Products.CMFCore.utils import getToolByName 
    12 try: 
    13     from Products.CMFCore.permissions import ManagePortal, ReplyToItem 
    14 except ImportError: 
    15     from Products.CMFCore.CMFCorePermissions import ManagePortal,ReplyToItem 
    16 from Products.MailHost.MailHost import MailBase 
     7from Products.CMFCore.permissions import ManagePortal, ReplyToItem 
     8 
     9from Products.qPloneComments.utils import getMsg 
    1710 
    1811import re 
     12from common import * 
     13from helperNotify import * 
     14from testQPloneCommentsModeration import USERS, COMMON_USERS_IDS, DM_USERS_IDS 
    1915 
    20 from Products.qPloneComments.utils import getMsg 
    21 from testQPloneCommentsModeration import USERS, COMMON_USERS_IDS, DM_USERS_IDS 
    22 from helperNotify import * 
    23 from common import * 
    2416 
    2517PRODUCT = 'qPloneComments' 
     
    4234REXP_SUBJ = re.compile("Subject:\s*(.*?)$",re.M) 
    4335 
     36 
    4437class TestNotificationRecipients(PloneTestCase.FunctionalTestCase): 
    4538    """ Test is notifications sends to right recipients. """ 
     
    5144        self.request.form['subject'] = "Reply of '%s'" % self.request.form['Creator'] 
    5245        self.request.form['body_text'] = "text of reply" 
    53  
    5446 
    5547    def afterSetUp(self): 
     
    6860        doc_fti = portal_types.getTypeInfo('Document') 
    6961        doc_fti._updateProperty('allow_discussion', 1) 
    70          
     62 
    7163        # Make sure Documents are visible by default 
    7264        # XXX only do this for plone 3 
     
    112104        self.assertEqual(len(mails), 1) 
    113105        self.checkToANDSubj(mails, to="discussion.manager@test.com", subj="New comment awaits moderation") 
    114  
    115106 
    116107    def test_PublishReply(self): 
     
    159150 
    160151 
    161 TESTS = [TestNotificationRecipients] 
    162  
    163152def test_suite(): 
    164153    from unittest import TestSuite, makeSuite 
    165154    suite = TestSuite() 
    166     for t in TESTS: 
    167         suite.addTest(makeSuite(t)) 
     155    suite.addTest(makeSuite(TestNotificationRecipients)) 
    168156    return suite 
    169  
    170 if __name__ == '__main__': 
    171     framework() 
    172  
  • qPloneComments/branches/plone-3.0/tests/testQPloneCommentsPermission.py

    r1018 r1126  
    33# 
    44 
    5 import os, sys, string 
    6 if __name__ == '__main__': 
    7     execfile(os.path.join(sys.path[0], 'framework.py')) 
    8  
    95from Products.PloneTestCase import PloneTestCase 
    106from Products.CMFCore.utils import getToolByName 
    11 from AccessControl import getSecurityManager 
     7 
     8from Products.CMFDefault.DiscussionItem import DiscussionItemContainer 
    129 
    1310PRODUCT = 'qPloneComments' 
     
    1613PloneTestCase.setupPloneSite() 
    1714 
    18 from Products.CMFDefault.DiscussionItem import DiscussionItemContainer 
    1915 
    2016class TestPermission(PloneTestCase.PloneTestCase): 
     
    2319        self.loginAsPortalOwner() 
    2420        self.portal.portal_quickinstaller.installProduct(PRODUCT) 
    25          
     21 
    2622    def test_install_moderate_discussion_permission(self): 
    2723        roles = [item['name'] for item in self.portal.rolesOfPermission(PERM_NAME) if item['selected'] == 'SELECTED'] 
     
    4238    suite.addTest(makeSuite(TestPermission)) 
    4339    return suite 
    44  
    45 if __name__ == '__main__': 
    46     framework() 
    47