Example #1
0
    def test_mix(self):
        text = """
        http://toto.org/link.html [[archive1.html|(Archive)]]
        
        """
        temp = tempfile.mkstemp()[1]
        with open(temp, 'w') as tmp:
            tmp.write(text)

        zim_files = [temp]
        zim_archives = ['archive1.html', 'archive2.html']
        valid =  ['archive2']
        result = get_unlinked_archive(zim_files, zim_archives) 
        self.assertEqual(result, valid)
Example #2
0
    def test_all_missing(self):
        text = """
        
        """
        temp = tempfile.mkstemp()[1]
        with open(temp, 'w') as tmp:
            tmp.write(text)

        zim_files = [temp]
        zim_archives = ['archive1.html', 'archive2.html']
        valid =  ['archive1', 'archive2']
        result = get_unlinked_archive(zim_files, zim_archives) 
        #result is sorted because the method does
        #not take care of the order
        result.sort()
        self.assertEqual(result, valid)