class WikiRendererTestCase(unittest.TestCase): def setUp(self): self.env = EnvironmentStub() self.mod = WikiRenderer(self.env) def test_load_stylesheet(self): text = textwrap.dedent("""\ {{{#!text/x-diff --- a/file.txt 2014-11-13 01:16:06 +0000 +++ b/file.txt 2014-11-13 01:16:06 +0000 @@ -1 +1 @@ -old line +new line }}} """) req = MockRequest(self.env, method='POST', path_info='/wiki_render', args={ 'id': 'WikiStart', 'text': text }) self.assertTrue(self.mod.match_request(req)) try: self.mod.process_request(req) self.fail('RequestDone not raised') except RequestDone: output = req.response_sent.getvalue() self.assertIn('<div class="wiki-code">', output) self.assertIn('<table class="trac-diff inline"', output) self.assertIn( 'jQuery.loadStyleSheet("' '/trac.cgi/chrome/common/css/diff.css"', output)
class WikiRendererTestCase(unittest.TestCase): def setUp(self): self.env = EnvironmentStub() self.mod = WikiRenderer(self.env) def test_load_stylesheet(self): buf = StringIO() def send(data): buf.write(data) raise RequestDone text = """\ {{{#!text/x-diff --- a/file.txt 2014-11-13 01:16:06 +0000 +++ b/file.txt 2014-11-13 01:16:06 +0000 @@ -1 +1 @@ -old line +new line }}} """ req = Mock(method='POST', path_info='/wiki_render', session={}, args={'id': 'WikiStart', 'text': text}, abs_href=Href('http://example.com/'), href=Href('/'), chrome={'links': {}, 'scripts': []}, perm=None, authname=None, tz=None, send=send) self.assertTrue(self.mod.match_request(req)) try: self.mod.process_request(req) self.fail('RequestDone not raised') except RequestDone: output = buf.getvalue() self.assertIn('<div class="code"><pre>', output) self.assertIn('jQuery.loadStyleSheet("' '/chrome/common/css/diff.css"', output)
class WikiRendererTestCase(unittest.TestCase): def setUp(self): self.env = EnvironmentStub() self.mod = WikiRenderer(self.env) def test_load_stylesheet(self): buf = StringIO() def send(data): buf.write(data) raise RequestDone text = """\ {{{#!text/x-diff --- a/file.txt 2014-11-13 01:16:06 +0000 +++ b/file.txt 2014-11-13 01:16:06 +0000 @@ -1 +1 @@ -old line +new line }}} """ req = Mock(method='POST', path_info='/wiki_render', session={}, args={ 'id': 'WikiStart', 'text': text }, abs_href=Href('http://example.com/'), href=Href('/'), chrome={ 'links': {}, 'scripts': [] }, perm=None, authname=None, tz=None, send=send) self.assertTrue(self.mod.match_request(req)) try: self.mod.process_request(req) self.fail('RequestDone not raised') except RequestDone: output = buf.getvalue() self.assertIn('<div class="code"><pre>', output) self.assertIn( 'jQuery.loadStyleSheet("' '/chrome/common/css/diff.css"', output)
def setUp(self): self.env = EnvironmentStub() self.mod = WikiRenderer(self.env)