def test_add_file2(self): sample_file = metadata.Photo( original_filepath=self.sample_img3, year=2012) self.source_repo.add_file(sample_file) self.assertTrue(utils.exists(self.tempdir, 'photos/2012/img_0337.jpg'))
def test_add_file_with_title_with_duplicates(self): sample_file1 = metadata.Photo( original_filepath=self.sample_img1, year=2011, title="Some nice title") sample_file2 = metadata.Photo( original_filepath=self.sample_img2, year=2011, title="Some nice title") self.source_repo.add_file(sample_file1) self.source_repo.add_file(sample_file2) self.assertTrue(utils.exists(self.tempdir, 'photos/2011/some-nice-title.jpg')) self.assertTrue(utils.exists(self.tempdir, 'photos/2011/some-nice-title_.jpg')) self.assertEquals(sample_file1.id, 'photos/2011/some-nice-title.jpg') self.assertEquals(sample_file2.id, 'photos/2011/some-nice-title_.jpg')
def test_ensure_directory3(self): self.source_repo.ensure_directory('photos', '1972') self.assertTrue(utils.exists(self.tempdir, 'photos', '1972'))