view test/test_mailer.py @ 4472:34dce76bb202

Multilink fixes and optimizations: - Optimisation: Late evaluation of Multilinks (only in rdbms backends): previously we materialized each multilink in a Node -- this creates an SQL query for each multilink (e.g. 'files' and 'messages' for each line in the issue index display) -- even if the multilinks aren't displayed. Now we compute multilinks only if they're accessed (and keep them cached). - Add a filter_iter similar to the existing filter call. This feature is considered experimental. This is currently not used in the web-interface but passes all tests for the filter call except sorting by Multilinks (which isn't supported by SQL and isn't a sane concept anyway). When using filter_iter instead of filter this saves a *lot* of SQL queries: Filter returns only the IDs of Nodes in the database, the additional content of a Node has to be fetched in a separate SQL call. The new filter_iter also returns the IDs of Nodes (one by one, it's an iterator) but pre-seeds the cache with the content of the Node. The information needed for seeding the cache is retrieved in the same SQL query as the ids.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Mon, 21 Mar 2011 20:44:39 +0000
parents 94ee533613ac
children 182d8c41a3aa
line wrap: on
line source

#-*- encoding: utf8 -*-
import unittest

from roundup import mailer

class EncodingTestCase(unittest.TestCase):
    def test(self):
        a = lambda n, a, c, o: self.assertEquals(mailer.nice_sender_header(n,
            a, c), o)
        a('ascii', 'ascii@test.com', 'latin1', 'ascii <ascii@test.com>')
        a(u'café', 'ascii@test.com', 'latin1',
            '=?latin1?q?caf=E9?= <ascii@test.com>')
        a('as"ii', 'ascii@test.com', 'latin1', '"as\\"ii" <ascii@test.com>')

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(EncodingTestCase))
    return suite

if __name__ == '__main__':
    runner = unittest.TextTestRunner()
    unittest.main(testRunner=runner)

# vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/