~ubuntu-branches/ubuntu/edgy/trac/edgy

« back to all changes in this revision

Viewing changes to trac/tests/wiki.py

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2005-07-24 12:21:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050724122152-3xf8v1oqf2jcqk5n
Tags: 0.8.4-1ubuntu1
Resynchronise with Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import StringIO
3
3
import unittest
4
4
 
5
 
from Wiki import Formatter
 
5
from trac.Wiki import Formatter
6
6
 
7
7
class WikiTestCase(unittest.TestCase):
 
8
 
8
9
    def __init__(self, input, correct):
9
10
        unittest.TestCase.__init__(self, 'test')
10
11
        self.input = input
13
14
    def test(self):
14
15
        """Testing WikiFormatter"""
15
16
        import Href
 
17
        import Logging
16
18
        class Environment:
17
19
            def __init__(self):
 
20
                self.log = Logging.logger_factory('null')
18
21
                self.href = Href.Href('/')
19
22
                self._wiki_pages = {}
20
23
        class Cursor:
24
27
            def cursor(self):
25
28
                return Cursor()
26
29
 
27
 
                
28
30
        out = StringIO.StringIO()
29
31
        Formatter(None, Environment(), Connection()).format(self.input, out)
30
 
        if out.getvalue() != self.correct:
31
 
            print "'%s' != '%s'" % (out.getvalue(), self.correct)
32
 
            assert self.correct == out.getvalue()
 
32
        self.assertEquals(self.correct, out.getvalue())
33
33
 
34
34
def suite():
35
35
    suite = unittest.TestSuite()
40
40
        input, correct = test.split('-' * 30 + '\n')
41
41
        suite.addTest(WikiTestCase(input, correct))
42
42
    return suite
43