Show
Ignore:
Timestamp:
05/31/08 22:01:20 (22 months ago)
Author:
JensDiemer
Message:
  • add a few test for the new plugin models
  • unittest: test plugin would be copied to the normal plugins. So this plugin would be auto installed with all other plugins.
  • Bugfix in lucidTag.py: 1 should not be converted to True ;)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/tests/__init__.py

    r1609 r1612  
    111111 
    112112from PyLucid.tools.db_dump import loaddb 
    113 from PyLucid.tools.Diff import make_diff 
     113from PyLucid.tools.Diff import make_diff, diff_lines 
    114114from PyLucid.install.install import DB_DumpFakeOptions 
    115115from PyLucid.models import Page, Style, Template, Plugin 
     
    190190# (relative path here! Because the current work dir can chaned!) 
    191191TEST_PLUGIN_SRC = "tests/unittest_plugin/" 
    192 TEST_PLUGIN_DST = "PyLucid/plugins_external/unittest_plugin" 
     192TEST_PLUGIN_DST = "PyLucid/plugins_internal/unittest_plugin" 
    193193 
    194194 
     
    243243            if txt in response.content: 
    244244                error(response, "Text should not be in response: '%s'" % txt) 
     245 
     246    def assertEqual2(self, first, second): 
     247        """ 
     248        Same as the original, but display a diff on error. 
     249        Makes only sence if the string contains more lines (\n) 
     250        """ 
     251        if first == second: 
     252            # is equal, ok 
     253            return 
     254 
     255        error_msg = "Strings not equal:\n" 
     256        error_msg += "1: %r\n" % first 
     257        error_msg += "2: %r\n" % second 
     258        error_msg += "Diff:\n" 
     259        error_msg += diff_lines(first, second) 
     260 
     261        self.fail(error_msg) 
    245262 
    246263    def assertLists(self, is_list, should_be_list, sort=True): 
     
    434451    """ 
    435452    initialize the unittest plugin 
    436     -copy ./tests/unittest_plugin/ into ./PyLucid/plugins_external/ 
    437     -install+activate the plugin into the database 
     453    -copy ./tests/unittest_plugin/ into ./PyLucid/plugins_internal/ 
     454 
     455    The plugin would be installed in install_internal_plugins() as a normal Plugin. 
    438456    """ 
    439457    print "initialize the unittest plugin" 
     
    456474            raise 
    457475 
    458 #    install_plugin( 
    459 #        package_name = "PyLucid.plugins_external", 
    460 #        plugin_name = "unittest_plugin", 
    461 #        debug = True, 
    462 #        active=True, 
    463 #        extra_verbose=True, 
    464 #    ) 
    465476 
    466477 
     
    576587    """ 
    577588    load_db_dumps(verbosity) 
     589    init_unittest_plugin() 
    578590    install_internal_plugins(verbosity) 
    579591    create_users() # Create all test users 
    580592    create_pages(TEST_PAGES) # Create the test pages 
    581     init_unittest_plugin() 
    582593    create_test_fixture(verbosity) 
    583     install_plugin( 
    584         package_name = "PyLucid.plugins_external", 
    585         plugin_name = "unittest_plugin", 
    586         debug = True, 
    587         active=True, 
    588         extra_verbose=True, 
    589     ) 
     594 
    590595 
    591596def teardown_pylucid():