def test_before_render_hook(self): context = self.create_dummy() request = self.create_dummy() builder = self.mocker.mock() self.replay() layout = DefaultLayout(context, request, builder) layout.before_render_hook() packages = '\n'.join([ r'\usepackage[utf8]{inputenc}', r'\usepackage{ae,aecompl}', r'\usepackage[ngerman]{babel}', r'\usepackage{fancyhdr}', r'\usepackage[left=35mm, right=10mm, top=55mm, ' + \ r'bottom=10.5mm]{geometry}', r'\usepackage{graphicx}', r'\usepackage{lastpage}', r'\usepackage[neveradjust]{paralist}', r'\usepackage{textcomp}', r'\usepackage[absolute, overlay]{textpos}', r'\usepackage[compact]{titlesec}', r'\usepackage{wrapfig}', r'\usepackage{array,supertabular}', r'\usepackage{setspace}', '', ]) self.assertEqual(layout.get_packages_latex(), packages)
def test_rendering(self): context = self.stub() request = self.create_dummy() builder = self.stub() self.expect(builder.add_file('logo.pdf', data=ANY)) member = self.stub() self.expect(context.Creator()).result('john.doe') self.expect(self.portal_membership.getMemberById('john.doe')).result( member) self.expect(member.getProperty('phone_number', ' ')).result( '012 345 6789') self.replay() layout = DefaultLayout(context, request, builder) latex = layout.render_latex('LATEX CONTENT') self.assertIn('LATEX CONTENT', latex) self.assertIn(layout.get_packages_latex(), latex) self.assertIn(r'\phantom{foo}\vspace{-2\baselineskip}', latex)
def test_rendering(self): context = self.stub() request = self.create_dummy() builder = self.stub() self.expect(builder.add_file('logo.pdf', data=ANY)) member = self.stub() self.expect(context.Creator()).result('john.doe') self.expect( self.portal_membership.getMemberById('john.doe')).result(member) self.expect(member.getProperty('phone_number', ' ')).result('012 345 6789') self.replay() layout = DefaultLayout(context, request, builder) latex = layout.render_latex('LATEX CONTENT') self.assertIn('LATEX CONTENT', latex) self.assertIn(layout.get_packages_latex(), latex) self.assertIn(r'\phantom{foo}\vspace{-2\baselineskip}', latex)