Example #1
0
 def test_path_replace_no(self):
     ss = '''
         #Markdown
         with no image
     '''
     img_det = ImageManager(ss)
     self.assertEqual(ss, img_det.replace_path_imgs('/main'))
Example #2
0
 def test_path_replace_multiple(self):
     for i in range(1, 5):
         text_list = self.create_random_text_list(i)
         imgs_list = self.create_random_imgs(i)
         path = '/complex_path/test/'
         imgs_list_expected = [[img[0], path + img[1].split('/')[-1]]
                               for img in imgs_list]
         text = self.merge_text_and_img_lists(text_list, imgs_list)
         text_expected = self.merge_text_and_img_lists(
             text_list, imgs_list_expected)
         img_det = ImageManager(text)
         self.assertEqual(text_expected, img_det.replace_path_imgs(path))
Example #3
0
    def test_path_replace_one(self):
        ss = '''
            #Markdown
            with image
            ![lkjsd](img.png)
        '''

        ss_expected_1 = '''
            #Markdown
            with image
            ![lkjsd](/main/img.png)
        '''

        ss_expected_2 = '''
            #Markdown
            with image
            ![lkjsd](main/img.png)
        '''
        img_det = ImageManager(ss)
        self.assertEqual(ss_expected_1, img_det.replace_path_imgs('/main'))
        self.assertEqual(ss_expected_2, img_det.replace_path_imgs('main'))