@@ 883-907 (lines=25) @@ | ||
880 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
881 | ||
882 | # gh-89 (setting album then title reverts album) |
|
883 | def test_process_video_with_album_then_title(): |
|
884 | filesystem = FileSystem() |
|
885 | temporary_folder, folder = helper.create_working_folder() |
|
886 | ||
887 | origin = os.path.join(folder,'movie.mov') |
|
888 | shutil.copyfile(helper.get_file('video.mov'), origin) |
|
889 | ||
890 | origin_checksum = helper.checksum(origin) |
|
891 | ||
892 | origin_checksum_preprocess = helper.checksum(origin) |
|
893 | media = Video(origin) |
|
894 | media.set_album('test_album') |
|
895 | media.set_title('test_title') |
|
896 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
897 | ||
898 | destination_checksum = helper.checksum(destination) |
|
899 | ||
900 | shutil.rmtree(folder) |
|
901 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
902 | ||
903 | assert origin_checksum_preprocess is not None |
|
904 | assert origin_checksum is not None |
|
905 | assert destination_checksum is not None |
|
906 | assert origin_checksum_preprocess == origin_checksum |
|
907 | assert helper.path_tz_fix(os.path.join('2015-01-Jan','test_album','2015-01-19_12-45-11-movie-test_title.mov')) in destination, destination |
|
908 | ||
909 | @mock.patch('elodie.config.config_file', '%s/config.ini-fallback-folder' % gettempdir()) |
|
910 | def test_process_file_fallback_folder(): |
|
@@ 859-880 (lines=22) @@ | ||
856 | assert origin_checksum_preprocess == origin_checksum |
|
857 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
858 | ||
859 | def test_process_file_with_album_and_title_and_location(): |
|
860 | filesystem = FileSystem() |
|
861 | temporary_folder, folder = helper.create_working_folder() |
|
862 | ||
863 | origin = os.path.join(folder,'photo.jpg') |
|
864 | shutil.copyfile(helper.get_file('with-album-and-title-and-location.jpg'), origin) |
|
865 | ||
866 | origin_checksum_preprocess = helper.checksum(origin) |
|
867 | media = Photo(origin) |
|
868 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
869 | ||
870 | origin_checksum = helper.checksum(origin) |
|
871 | destination_checksum = helper.checksum(destination) |
|
872 | ||
873 | shutil.rmtree(folder) |
|
874 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
875 | ||
876 | assert origin_checksum_preprocess is not None |
|
877 | assert origin_checksum is not None |
|
878 | assert destination_checksum is not None |
|
879 | assert origin_checksum_preprocess == origin_checksum |
|
880 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
881 | ||
882 | # gh-89 (setting album then title reverts album) |
|
883 | def test_process_video_with_album_then_title(): |
|
@@ 836-857 (lines=22) @@ | ||
833 | assert origin_checksum_preprocess == origin_checksum |
|
834 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo.jpg')) in destination, destination |
|
835 | ||
836 | def test_process_file_with_album_and_title(): |
|
837 | filesystem = FileSystem() |
|
838 | temporary_folder, folder = helper.create_working_folder() |
|
839 | ||
840 | origin = os.path.join(folder,'photo.jpg') |
|
841 | shutil.copyfile(helper.get_file('with-album-and-title.jpg'), origin) |
|
842 | ||
843 | origin_checksum_preprocess = helper.checksum(origin) |
|
844 | media = Photo(origin) |
|
845 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
846 | ||
847 | origin_checksum = helper.checksum(origin) |
|
848 | destination_checksum = helper.checksum(destination) |
|
849 | ||
850 | shutil.rmtree(folder) |
|
851 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
852 | ||
853 | assert origin_checksum_preprocess is not None |
|
854 | assert origin_checksum is not None |
|
855 | assert destination_checksum is not None |
|
856 | assert origin_checksum_preprocess == origin_checksum |
|
857 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
858 | ||
859 | def test_process_file_with_album_and_title_and_location(): |
|
860 | filesystem = FileSystem() |
|
@@ 813-834 (lines=22) @@ | ||
810 | assert origin_checksum_preprocess == origin_checksum |
|
811 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Sunnyvale','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
812 | ||
813 | def test_process_file_with_album(): |
|
814 | filesystem = FileSystem() |
|
815 | temporary_folder, folder = helper.create_working_folder() |
|
816 | ||
817 | origin = os.path.join(folder,'photo.jpg') |
|
818 | shutil.copyfile(helper.get_file('with-album.jpg'), origin) |
|
819 | ||
820 | origin_checksum_preprocess = helper.checksum(origin) |
|
821 | media = Photo(origin) |
|
822 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
823 | ||
824 | origin_checksum = helper.checksum(origin) |
|
825 | destination_checksum = helper.checksum(destination) |
|
826 | ||
827 | shutil.rmtree(folder) |
|
828 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
829 | ||
830 | assert origin_checksum_preprocess is not None |
|
831 | assert origin_checksum is not None |
|
832 | assert destination_checksum is not None |
|
833 | assert origin_checksum_preprocess == origin_checksum |
|
834 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Test Album','2015-12-05_00-59-26-photo.jpg')) in destination, destination |
|
835 | ||
836 | def test_process_file_with_album_and_title(): |
|
837 | filesystem = FileSystem() |
|
@@ 790-811 (lines=22) @@ | ||
787 | assert origin_checksum_preprocess == origin_checksum, (origin_checksum_preprocess, origin_checksum) |
|
788 | ||
789 | ||
790 | def test_process_file_with_location_and_title(): |
|
791 | filesystem = FileSystem() |
|
792 | temporary_folder, folder = helper.create_working_folder() |
|
793 | ||
794 | origin = os.path.join(folder,'photo.jpg') |
|
795 | shutil.copyfile(helper.get_file('with-location-and-title.jpg'), origin) |
|
796 | ||
797 | origin_checksum_preprocess = helper.checksum(origin) |
|
798 | media = Photo(origin) |
|
799 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
800 | ||
801 | origin_checksum = helper.checksum(origin) |
|
802 | destination_checksum = helper.checksum(destination) |
|
803 | ||
804 | shutil.rmtree(folder) |
|
805 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
806 | ||
807 | assert origin_checksum_preprocess is not None |
|
808 | assert origin_checksum is not None |
|
809 | assert destination_checksum is not None |
|
810 | assert origin_checksum_preprocess == origin_checksum |
|
811 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Sunnyvale','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
812 | ||
813 | def test_process_file_with_album(): |
|
814 | filesystem = FileSystem() |
|
@@ 744-765 (lines=22) @@ | ||
741 | assert origin_checksum_preprocess == origin_checksum |
|
742 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Unknown Location','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
743 | ||
744 | def test_process_file_with_location(): |
|
745 | filesystem = FileSystem() |
|
746 | temporary_folder, folder = helper.create_working_folder() |
|
747 | ||
748 | origin = os.path.join(folder,'photo.jpg') |
|
749 | shutil.copyfile(helper.get_file('with-location.jpg'), origin) |
|
750 | ||
751 | origin_checksum_preprocess = helper.checksum(origin) |
|
752 | media = Photo(origin) |
|
753 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
754 | ||
755 | origin_checksum = helper.checksum(origin) |
|
756 | destination_checksum = helper.checksum(destination) |
|
757 | ||
758 | shutil.rmtree(folder) |
|
759 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
760 | ||
761 | assert origin_checksum_preprocess is not None |
|
762 | assert origin_checksum is not None |
|
763 | assert destination_checksum is not None |
|
764 | assert origin_checksum_preprocess == origin_checksum |
|
765 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Sunnyvale','2015-12-05_00-59-26-photo.jpg')) in destination, destination |
|
766 | ||
767 | def test_process_file_validate_original_checksum(): |
|
768 | filesystem = FileSystem() |
|
@@ 721-742 (lines=22) @@ | ||
718 | assert origin_checksum_preprocess == origin_checksum |
|
719 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Unknown Location','2015-12-05_00-59-26-photo.jpg')) in destination, destination |
|
720 | ||
721 | def test_process_file_with_title(): |
|
722 | filesystem = FileSystem() |
|
723 | temporary_folder, folder = helper.create_working_folder() |
|
724 | ||
725 | origin = '%s/photo.jpg' % folder |
|
726 | shutil.copyfile(helper.get_file('with-title.jpg'), origin) |
|
727 | ||
728 | origin_checksum_preprocess = helper.checksum(origin) |
|
729 | media = Photo(origin) |
|
730 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
731 | ||
732 | origin_checksum = helper.checksum(origin) |
|
733 | destination_checksum = helper.checksum(destination) |
|
734 | ||
735 | shutil.rmtree(folder) |
|
736 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
737 | ||
738 | assert origin_checksum_preprocess is not None |
|
739 | assert origin_checksum is not None |
|
740 | assert destination_checksum is not None |
|
741 | assert origin_checksum_preprocess == origin_checksum |
|
742 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Unknown Location','2015-12-05_00-59-26-photo-some-title.jpg')) in destination, destination |
|
743 | ||
744 | def test_process_file_with_location(): |
|
745 | filesystem = FileSystem() |
|
@@ 698-719 (lines=22) @@ | ||
695 | ||
696 | assert destination is None |
|
697 | ||
698 | def test_process_file_plain(): |
|
699 | filesystem = FileSystem() |
|
700 | temporary_folder, folder = helper.create_working_folder() |
|
701 | ||
702 | origin = os.path.join(folder,'photo.jpg') |
|
703 | shutil.copyfile(helper.get_file('plain.jpg'), origin) |
|
704 | ||
705 | origin_checksum_preprocess = helper.checksum(origin) |
|
706 | media = Photo(origin) |
|
707 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
708 | ||
709 | origin_checksum = helper.checksum(origin) |
|
710 | destination_checksum = helper.checksum(destination) |
|
711 | ||
712 | shutil.rmtree(folder) |
|
713 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
714 | ||
715 | assert origin_checksum_preprocess is not None |
|
716 | assert origin_checksum is not None |
|
717 | assert destination_checksum is not None |
|
718 | assert origin_checksum_preprocess == origin_checksum |
|
719 | assert helper.path_tz_fix(os.path.join('2015-12-Dec','Unknown Location','2015-12-05_00-59-26-photo.jpg')) in destination, destination |
|
720 | ||
721 | def test_process_file_with_title(): |
|
722 | filesystem = FileSystem() |