Changeset 1248

Show
Ignore:
Timestamp:
04/07/08 16:15:12 (8 months ago)
Author:
sgillies
Message:

Bring name and location browser tests back into the test runner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesEntity/trunk/tests/LocationViews.txt

    r615 r1248  
    2626the navtree. 
    2727 
     28Test login 
     29 
     30    >>> portal_url = self.portal.absolute_url() 
     31 
     32The following is useful when writing and debugging testbrowser tests. It lets 
     33us see all error messages in the error_log. 
     34 
    2835    >>> self.portal.error_log._ignored_exceptions = () 
    2936    >>> self.portal.left_slots = self.portal.right_slots = [] 
    3037 
    31 Browse the Name 
     38With that in place, we can go to the portal front page and log in. We will 
     39do this using the default user from PloneTestCase: 
     40 
     41    >>> from Products.PloneTestCase.setup import portal_owner, default_password 
     42    >>> browser.open(portal_url) 
     43 
     44We have the login portlet, so let's use that. 
     45 
     46    >>> browser.getControl(name='__ac_name').value = portal_owner 
     47    >>> browser.getControl(name='__ac_password').value = default_password 
     48    >>> browser.getControl(name='submit').click() 
     49 
     50Here, we set the value of the fields on the login form and then simulate a 
     51submit click. 
     52 
     53We then test that we are still on the portal front page: 
     54 
     55    >>> browser.url == portal_url 
     56    True 
     57     
     58And we ensure that we get the friendly logged-in message: 
     59 
     60    >>> "You are now logged in" in browser.contents 
     61    True 
     62 
     63Browse the Location 
    3264 
    3365    >>> url = x.absolute_url() 
  • PleiadesEntity/trunk/tests/NameViews.txt

    r746 r1248  
    3434the navtree. 
    3535 
     36Test login 
     37 
     38    >>> portal_url = self.portal.absolute_url() 
     39 
     40The following is useful when writing and debugging testbrowser tests. It lets 
     41us see all error messages in the error_log. 
     42 
    3643    >>> self.portal.error_log._ignored_exceptions = () 
    3744    >>> self.portal.left_slots = self.portal.right_slots = [] 
     45 
     46With that in place, we can go to the portal front page and log in. We will 
     47do this using the default user from PloneTestCase: 
     48 
     49    >>> from Products.PloneTestCase.setup import portal_owner, default_password 
     50    >>> browser.open(portal_url) 
     51 
     52We have the login portlet, so let's use that. 
     53 
     54    >>> browser.getControl(name='__ac_name').value = portal_owner 
     55    >>> browser.getControl(name='__ac_password').value = default_password 
     56    >>> browser.getControl(name='submit').click() 
     57 
     58Here, we set the value of the fields on the login form and then simulate a 
     59submit click. 
     60 
     61We then test that we are still on the portal front page: 
     62 
     63    >>> browser.url == portal_url 
     64    True 
     65     
     66And we ensure that we get the friendly logged-in message: 
     67 
     68    >>> "You are now logged in" in browser.contents 
     69    True 
    3870 
    3971Browse the Name 
     
    80112Edit the name, modify the attestation using legal characters and language to verify validation 
    81113 
    82     >>> browser.getLink('Log in').click() 
    83     >>> browser.getControl('Login Name').value = 'test_user_1_' 
    84     >>> browser.getControl('Password').value = 'secret' 
    85     >>> browser.getControl('Log in').click() 
    86114    >>> url = url + '/base_edit' 
    87115    >>> browser.open(url) 
     
    105133    >>> browser.contents 
    106134    '...23 invalid character(s) in name Municipium Noxium Maximum...' 
     135 
  • PleiadesEntity/trunk/tests/test_docfiles.py

    r1247 r1248  
    1313ptc.installProduct('PleiadesEntity') 
    1414ptc.setupPloneSite(products=['Archetypes', 'ATVocabularyManager', 'Geographer', 'PleiadesEntity']) 
    15  
    16 #REQUIRE_TESTBROWSER = ['PublishGeoEntity.txt'] 
    1715 
    1816optionflags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE 
     
    4442            optionflags=optionflags, 
    4543            ), 
    46         #ztc.FunctionalDocFileSuite( 
    47         #    'browser.txt', 
    48         #    package='Products.Geographer.tests', 
    49         #    test_class=ptc.FunctionalTestCase, 
    50         #    optionflags=optionflags, 
    51         #    ) 
     44        ztc.FunctionalDocFileSuite( 
     45            'LocationViews.txt', 
     46            package='Products.PleiadesEntity.tests', 
     47            test_class=PleiadesEntityTestCase, 
     48            optionflags=optionflags, 
     49            ), 
     50        ztc.FunctionalDocFileSuite( 
     51            'NameViews.txt', 
     52            package='Products.PleiadesEntity.tests', 
     53            test_class=PleiadesEntityTestCase, 
     54            optionflags=optionflags, 
     55            ), 
    5256        ]) 
    5357 
    5458if __name__ == '__main__': 
    5559    unittest.main(defaultTest='test_suite') 
    56  
    57  
    58 #def list_doctests(): 
    59 #    return [filename for filename in 
    60 #            glob.glob(os.path.sep.join([TEST_HOME, '*.txt']))] 
    61  
    62 #d#ef list_nontestbrowser_tests(): 
    63 #    return [filename for filename in list_doctests() 
    64 #            if os.path.basename(filename) not in REQUIRE_TESTBROWSER] 
    65  
    66 #def test_suite(): 
    67 #  
    68 #    # BBB: We can obviously remove this when testbrowser is Plone 
    69 #    #      mainstream, read: with Five 1.4. 
    70 #    try: 
    71 #        import Products.Five.testbrowser 
    72 #    except ImportError: 
    73 #        print >> sys.stderr, ("WARNING: testbrowser not found - you probably" 
    74 #                              "need to add Five 1.4 to the Products folder. " 
    75 #                              "testbrowser tests skipped") 
    76 #        from Products.Five import zcml 
    77 #        from Products import PleiadesEntity 
    78 #        zcml.load_config('configure.zcml', package=PleiadesEntity) 
    79 #        filenames = list_nontestbrowser_tests() 
    80 #    else: 
    81 #        filenames = list_doctests() 
    82 # 
    83 #    return unittest.TestSuite( 
    84 #        [Suite(os.path.basename(filename), 
    85 #               optionflags=OPTIONFLAGS, 
    86 #               package=TEST_PACKAGE, 
    87 #               globs=_testing.__dict__, 
    88 #               test_class=PloneTestCase.FunctionalTestCase) 
    89 #         for filename in filenames] 
    90 #        )