def test_write_update_tag_for_image(self): source = os.path.join(config.photo_dir, 'boris-1.jpg') temp_file = os.path.join(config.photo_dir, 'test_file.jpg') shutil.copyfile(source, temp_file) try: tags = { 'comment': 'test comment', 'keywords': 'test,keywords', 'title': 'test title', 'subject': 'test subject', 'person_in_image': 'john doe,jill,john humpheries' } reader.update_exif('test_file.jpg', tags) retrieved_tags = reader.get_exif('test_file.jpg') self.assertDictContainsSubset(tags, retrieved_tags) finally: if (os.path.exists(temp_file)): os.remove(temp_file)
def test_write_update_tag_for_image(self): source = os.path.join(config.photo_dir, "boris-1.jpg") temp_file = os.path.join(config.photo_dir, "test_file.jpg") shutil.copyfile(source, temp_file) try: tags = { "comment": "test comment", "keywords": "test,keywords", "title": "test title", "subject": "test subject", "person_in_image": "john doe,jill,john humpheries", } reader.update_exif("test_file.jpg", tags) retrieved_tags = reader.get_exif("test_file.jpg") self.assertDictContainsSubset(tags, retrieved_tags) finally: if os.path.exists(temp_file): os.remove(temp_file)
def test_should_return_date(self): tags = reader.get_exif("IMG_3277.jpg", "date") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["date"], "2012-06-03T18:16:49")
def test_should_return_keywords(self): tags = reader.get_exif("IMG_3277.jpg", "keywords") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["keywords"], "keyword1,keyword2")
def test_should_fix_up_GPS_coordinates(self): tags = reader.get_exif("IMG_3277.jpg", "longitude,latitude") self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags["latitude"], 43.493369) self.assertEquals(tags["longitude"], -1.554734)
def test_tag_search_should_be_case_insensitive(self): tags = reader.get_exif("IMG_3277.jpg", "Make,moDel") self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags["make"], "Canon") self.assertEquals(tags["model"], "Canon EOS 550D")
def test_should_return_only_search_tags(self): tags = reader.get_exif("IMG_3277.jpg", "make,model") self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags["make"], "Canon") self.assertEquals(tags["model"], "Canon EOS 550D")
def test_should_return_all_tags(self): tags = reader.get_exif("IMG_3277.jpg") self.assertItemsEqual(tags.keys(), required_image_tags)
def test_should_return_blank_if_tag_not_found(self): tags = reader.get_exif("IMG_3277.jpg", "person_in_image") self.assertEquals(len(tags.keys()), 0)
def test_should_not_return_missing_search_tags(self): tags = reader.get_exif('IMG_3277.jpg', 'UNKNOWN_KEY') self.assertEquals(len(tags.keys()), 0)
def test_tag_search_should_be_case_insensitive(self): tags = reader.get_exif('IMG_3277.jpg', 'Make,moDel') self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags['make'], 'Canon') self.assertEquals(tags['model'], 'Canon EOS 550D')
def test_tag_search_should_handle_spaces_between_commas(self): tags = reader.get_exif('IMG_3277.jpg', ' make , model ') self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags['make'], 'Canon') self.assertEquals(tags['model'], 'Canon EOS 550D')
def test_should_return_only_search_tags(self): tags = reader.get_exif('IMG_3277.jpg', 'make,model') self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags['make'], 'Canon') self.assertEquals(tags['model'], 'Canon EOS 550D')
def test_should_return_all_tags_with_None_tag_parameter(self): tags = reader.get_exif('IMG_3277.jpg', None) self.assertItemsEqual(tags.keys(), required_image_tags)
def test_should_return_all_tags(self): tags = reader.get_exif('IMG_3277.jpg') self.assertItemsEqual(tags.keys(), required_image_tags)
def test_should_return_date3(self): tags = reader.get_exif("P9103882.jpg", "date") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["date"], "2012-09-10T10:30:00")
def test_should_return_blank_if_tag_not_found(self): tags = reader.get_exif('IMG_3277.jpg', 'person_in_image') self.assertEquals(len(tags.keys()), 0)
def test_should_fix_up_GPS_coordinates(self): tags = reader.get_exif('IMG_3277.jpg', 'longitude,latitude') self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags['latitude'], 43.493369) self.assertEquals(tags['longitude'], -1.554734)
def test_should_return_comment(self): tags = reader.get_exif('IMG_3277.jpg', 'comment') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['comment'], 'This is a comment')
def test_should_return_keywords(self): tags = reader.get_exif('IMG_3277.jpg', 'keywords') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['keywords'], 'keyword1,keyword2')
def test_should_return_all_tags_with_None_tag_parameter(self): tags = reader.get_exif("IMG_3277.jpg", None) self.assertItemsEqual(tags.keys(), required_image_tags)
def test_should_return_title(self): tags = reader.get_exif('IMG_3277.jpg', 'title') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['title'], 'Title goes here')
def test_tag_search_should_handle_spaces_between_commas(self): tags = reader.get_exif("IMG_3277.jpg", " make , model ") self.assertEquals(len(tags.keys()), 2) self.assertEquals(tags["make"], "Canon") self.assertEquals(tags["model"], "Canon EOS 550D")
def test_should_return_date(self): tags = reader.get_exif('IMG_3277.jpg', 'date') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['date'], '2012-06-03T18:16:49')
def test_should_not_return_missing_search_tags(self): tags = reader.get_exif("IMG_3277.jpg", "UNKNOWN_KEY") self.assertEquals(len(tags.keys()), 0)
def test_should_return_date2(self): tags = reader.get_exif('wilderness-01.jpg', 'date') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['date'], '2009-01-09T08:50:41')
def test_should_return_comment(self): tags = reader.get_exif("IMG_3277.jpg", "comment") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["comment"], "This is a comment")
def test_should_return_date3(self): tags = reader.get_exif('P9103882.jpg', 'date') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['date'], '2012-09-10T10:30:00')
def test_should_return_title(self): tags = reader.get_exif("IMG_3277.jpg", "title") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["title"], "Title goes here")
def test_should_return_subject(self): tags = reader.get_exif('IMG_3277.jpg', 'subject') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['subject'], 'This is a subject')
def test_should_return_date2(self): tags = reader.get_exif("wilderness-01.jpg", "date") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["date"], "2009-01-09T08:50:41")
def test_should_return_person_in_image(self): tags = reader.get_exif("IMG_6868.jpg", "person_in_image") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["person_in_image"], "rachel,richard")
def test_should_return_subject(self): tags = reader.get_exif("IMG_3277.jpg", "subject") self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags["subject"], "This is a subject")
def test_should_return_person_in_image(self): tags = reader.get_exif('IMG_6868.jpg', 'person_in_image') self.assertEquals(len(tags.keys()), 1) self.assertEquals(tags['person_in_image'], 'rachel,richard')