Example #1
0
	def runTest(self):
		'''Test proper linking of files in export'''
		notebook = tests.new_notebook(fakedir='/source/dir/')

		linker = StaticLinker('html', notebook)
		linker.set_usebase(True) # normally set by html format module
		linker.set_path(Path('foo:bar')) # normally set by exporter
		linker.set_base(Dir('/source/dir/foo')) # normally set by exporter

		self.assertEqual(linker.link_page('+dus'), './bar/dus.html')
		self.assertEqual(linker.link_page('dus'), './dus.html')
		self.assertEqual(linker.link_file('./dus.pdf'), './bar/dus.pdf')
		self.assertEqual(linker.link_file('../dus.pdf'), './dus.pdf')
		self.assertEqual(linker.link_file('../../dus.pdf'), '../dus.pdf')

		## setup environment for interwiki link
		if os.name == 'nt':
			uri = 'file:///C:/foo'
		else:
			uri = 'file:///foo'

		list = get_notebook_list()
		list.append(NotebookInfo(uri, interwiki='foo'))
		list.write()
		##

		href = interwiki_link('foo?Ideas:Task List')
		self.assertIsNotNone(href)
		self.assertEqual(linker.link('foo?Ideas:Task List'), uri + '/Ideas/Task_List.txt')
Example #2
0
    def runTest(self):
        '''Test proper linking of files in export'''
        notebook = tests.new_notebook(fakedir='/source/dir/')

        linker = StaticLinker('html', notebook)
        linker.set_usebase(True)  # normally set by html format module
        linker.set_path(Path('foo:bar'))  # normally set by exporter
        linker.set_base(Dir('/source/dir/foo'))  # normally set by exporter

        self.assertEqual(linker.link_page('+dus'), './bar/dus.html')
        self.assertEqual(linker.link_page('dus'), './dus.html')
        self.assertEqual(linker.link_file('./dus.pdf'), './bar/dus.pdf')
        self.assertEqual(linker.link_file('../dus.pdf'), './dus.pdf')
        self.assertEqual(linker.link_file('../../dus.pdf'), '../dus.pdf')

        ## setup environment for interwiki link
        if os.name == 'nt':
            uri = 'file:///C:/foo'
        else:
            uri = 'file:///foo'

        list = get_notebook_list()
        list.append(NotebookInfo(uri, interwiki='foo'))
        list.write()
        ##

        href = interwiki_link('foo?Ideas:Task List')
        self.assertIsNotNone(href)
        self.assertEqual(linker.link('foo?Ideas:Task List'),
                         uri + '/Ideas/Task_List.txt')