Пример #1
0
 def test_get_model_from_exif(self):
     testdata.create_test_data()
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     with open(os.path.join("source", "IMG_4810.jpeg"), 'rb') as exif_file:
         image_file = Image.open(exif_file)
         exif_data = image_file._getexif()
         self.assertEqual(get_model_from_exif(exif_data), "iPhone X")
     testdata.cleanup_test_data()
Пример #2
0
 def test_no_model_in_exif(self):
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     testdata.create_test_data()
     mediasort.scan_files("source", "target", 0, output_formats['MONTHLY'])
     self.assertTrue(
         os.path.exists(os.path.join("target", "2020-05", "other")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "2020-05", "other",
                          "IMG_20200506-125846.jpg")))
     testdata.cleanup_test_data()
Пример #3
0
 def test_other_output(self):
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     testdata.create_test_data()
     mediasort.scan_files("source", "target", 0, output_formats['MONTHLY'])
     self.assertTrue(
         os.path.exists(os.path.join("target", "2019-06", "other")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "2019-06", "other",
                          "IMG_20190610_190809.JPG")))
     testdata.cleanup_test_data()
Пример #4
0
 def test_recursion_lvl2(self):
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     testdata.create_test_data()
     mediasort.scan_files("source", "target", 2, output_formats['YEARLY'])
     self.assertTrue(os.path.exists(os.path.join("target", "1975")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "1975", "video",
                          "file11-19750517_091500.mp4")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "1975", "video",
                          "file21-19750517_091500.mp4")))
     testdata.cleanup_test_data()
Пример #5
0
 def test_monthly_output(self):
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     testdata.create_test_data()
     mediasort.scan_files("source", "target", 0, output_formats['MONTHLY'])
     self.assertTrue(os.path.exists("source"))
     self.assertTrue(os.path.exists(os.path.join("target", "2019-08")))
     self.assertTrue(
         os.path.exists(os.path.join("target", "1975-05", "video")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "1975-05", "video",
                          "file-19750517_091500.mp4")))
     self.assertTrue(
         os.path.isfile(os.path.join("target", "2019-08", "IMG_4810.jpeg")))
     testdata.cleanup_test_data()
Пример #6
0
 def test_yearly_output(self):
     self.log_testcase_name(inspect.currentframe().f_code.co_name)
     testdata.create_test_data()
     mediasort.scan_files("source", "target", 0, output_formats['YEARLY'])
     self.assertTrue(os.path.exists(os.path.join("target", "2019")))
     self.assertTrue(os.path.exists(os.path.join("target", "1975")))
     self.assertTrue(
         os.path.isfile(os.path.join("target", "2019", "IMG_4810.jpeg")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "2019", "other",
                          "IMG_20190610_190809.JPG")))
     self.assertTrue(
         os.path.isfile(
             os.path.join("target", "1975", "video",
                          "file-19750517-0915_bla.mp4")))
     testdata.cleanup_test_data()
Пример #7
0
    def test_detect_already_sorted(self):
        self.log_testcase_name(inspect.currentframe().f_code.co_name)
        testdata.create_test_data()
        mediasort.scan_files("source", "source", 1, output_formats['MONTHLY'])

        self.assertTrue(
            os.path.exists(os.path.join("source", "1975-05", "video")))
        self.assertTrue(
            os.path.isfile(
                os.path.join("source", "1975-05", "video",
                             "file-19750517_091500.mp4")))
        self.assertTrue(os.path.exists(os.path.join("source", "2019-08")))
        self.assertTrue(
            os.path.isfile(os.path.join("source", "2019-08", "IMG_4810.jpeg")))
        mediasort.scan_files("source", "source", 2, output_formats['MONTHLY'])
        self.assertFalse(os.path.exists(os.path.join("source", "2019",
                                                     "2019")))
        self.assertFalse(os.path.exists(os.path.join("source", "2020",
                                                     "2020")))
        testdata.cleanup_test_data()
Пример #8
0
    def test_daily_output(self):
        self.log_testcase_name(inspect.currentframe().f_code.co_name)
        testdata.create_test_data()
        mediasort.scan_files("source", "target", 0, output_formats['DAILY'])
        self.assertTrue(
            os.path.exists(os.path.join("target", "1975-05-17-Sat")))
        self.assertTrue(
            os.path.isfile(
                os.path.join("target", "1975-05-17-Sat", "video",
                             "file-19750517_091500.mp4")))
        self.assertTrue(
            os.path.isfile(
                os.path.join("target", "1975-05-17-Sat", "video",
                             "file-19750517_091500_1.mp4")))
        self.assertTrue(
            os.path.isfile(
                os.path.join("target", "1975-05-17-Sat", "video",
                             "file-19750517-091500.mp4")))

        testdata.cleanup_test_data()