def test_modify_interp_node_header(self):
        node = {
            'children': [],
            'header': 'This interprets 22(a), a paragraph',
            'label': ['872', '22', 'a', 'Interp'],
            'node_type': INTERP,
        }
        icl = InternalCitationLayer(None)
        icl.sectional = True
        builder = CFRHTMLBuilder([icl])

        builder.modify_interp_node(node)
        header = 'This interprets {0}, a paragraph'.format(
            icl.render_url(['872', '22', 'a'], '22(a)'))
        self.assertEqual(header, node['header_markup'])

        node['label'] = ['872', '22']
        builder.modify_interp_node(node)
        self.assertEqual(node['header'], node['header_markup'])
    def test_modify_interp_node_header(self):
        node = {
            'children': [],
            'header': 'This interprets 22(a), a paragraph',
            'label': ['872', '22', 'a', 'Interp'],
            'node_type': INTERP,
        }
        icl = InternalCitationLayer(None)
        icl.sectional = True
        builder = CFRHTMLBuilder([icl])

        builder.modify_interp_node(node)
        header = 'This interprets {0}, a paragraph'.format(
            icl.render_url(['872', '22', 'a'], '22(a)'))
        self.assertEqual(header, node['header_markup'])

        node['label'] = ['872', '22']
        builder.modify_interp_node(node)
        self.assertEqual(node['header'], node['header_markup'])
    def test_modify_interp_node_header(self):
        node = {
            'children': [],
            'header': 'This interprets 22(a), a paragraph',
            'label': ['872', '22', 'a', 'Interp'],
            'node_type': INTERP,
        }
        icl = InternalCitationLayer(None)
        icl.sectional = True
        ila = InlineLayersApplier()
        ila.add_layer(icl)
        builder = CFRHTMLBuilder(ila, None, None)

        builder.modify_interp_node(node)
        self.assertEqual(
            'This interprets ' + icl.render_url(['872', '22', 'a'], '22(a)') +
            ', a paragraph', node['header_markup'])

        node['label'] = ['872', '22']
        builder.modify_interp_node(node)
        self.assertEqual(node['header'], node['header_markup'])
    def test_modify_interp_node_header(self):
        node = {
            'children': [],
            'header': 'This interprets 22(a), a paragraph',
            'label': ['872', '22', 'a', 'Interp'],
            'node_type': INTERP,
        }
        icl = InternalCitationLayer(None)
        icl.sectional = True
        ila = InlineLayersApplier()
        ila.add_layer(icl)
        builder = HTMLBuilder(ila, None, None)

        builder.modify_interp_node(node)
        self.assertEqual('This interprets '
                         + icl.render_url(['872', '22', 'a'], '22(a)')
                         + ', a paragraph', node['header_markup'])

        node['label'] = ['872', '22']
        builder.modify_interp_node(node)
        self.assertEqual(node['header'], node['header_markup'])
Example #5
0
    def test_render_url(self, loader):
        icl = InternalCitationLayer(None)

        icl.render_url(['888', '123'], 'link')
        context = loader.get_template.return_value.render.call_args[0][0]
        self.assertEqual('#888-123', context['citation']['url'])
        self.assertEqual('link', context['citation']['label'])

        icl.sectional = True
        icl.version = 'vvvv'
        icl.render_url(['888', '123'], 'look')
        context = loader.get_template.return_value.render.call_args[0][0]

        self.assertTrue('888-123/vvvv#888-123' in context['citation']['url'])
        self.assertEqual('look', context['citation']['label'])
    def test_render_url(self, loader):
        icl = InternalCitationLayer(None)

        icl.render_url(['888', '123'], 'link')
        context = loader.get_template.return_value.render.call_args[0][0]
        self.assertEqual('#888-123', context['citation']['url'])
        self.assertEqual('link', context['citation']['label'])

        icl.sectional = True
        icl.version = 'vvvv'
        icl.render_url(['888', '123'], 'look')
        context = loader.get_template.return_value.render.call_args[0][0]

        self.assertTrue('888-123/vvvv#888-123' in context['citation']['url'])
        self.assertEqual('look', context['citation']['label'])