def test_get_metadata_local(): """Unit test for method get_metadata, local case.""" test_metadata = { 'original_file_name': 'test_image.jpg', 'original_path': abspath('tests'), 'original_file_size': '5K' } test_local_metadata = FileIO.get_metadata(TEST_LOCAL) del test_local_metadata['original_access_time'] assert test_metadata == test_local_metadata
def test_get_metadata_http_no_date(): """Unit test for method get_metadata, http and not date case.""" test_metadata = { 'original_file_name': 'axuvb8oxm7liskynxggfczfus.jpg', 'original_path': """http://images.protopage.com/view/ 572714""".replace('\n ', '') } test_request_metadata = FileIO.get_metadata(TEST_URL_NO_DATE) del test_request_metadata['original_access_time'] del test_request_metadata['original_file_size'] assert test_metadata == test_request_metadata
def test_get_metadata_http(): """Unit test for method get_metadata, http case.""" test_metadata = { 'original_file_name': '320px-Cheshm-Nazar.JPG', 'original_path': """https://upload.wikimedia.org/wikipedia/commons/ thumb/e/e4/Cheshm-Nazar.JPG""".replace('\n ', ''), 'original_file_size': '9K' } test_request_metadata = FileIO.get_metadata(TEST_URL) del test_request_metadata['original_access_time'] assert test_metadata == test_request_metadata