From e4b8cbee915aaa7c00e2d1e1584251a5a0236370 Mon Sep 17 00:00:00 2001 From: Sean Mac Gillicuddy Date: Thu, 19 Mar 2020 12:29:17 +0000 Subject: [PATCH] #3408 Refactoring the FileProcessor and GPSExtractor classes - remove empty test --- .../nrw/commons/upload/FileProcessorTest.kt | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 app/src/test/kotlin/fr/free/nrw/commons/upload/FileProcessorTest.kt diff --git a/app/src/test/kotlin/fr/free/nrw/commons/upload/FileProcessorTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/upload/FileProcessorTest.kt deleted file mode 100644 index 98f6a2e226..0000000000 --- a/app/src/test/kotlin/fr/free/nrw/commons/upload/FileProcessorTest.kt +++ /dev/null @@ -1,89 +0,0 @@ -package fr.free.nrw.commons.upload - -import android.content.SharedPreferences -import androidx.exifinterface.media.ExifInterface -import fr.free.nrw.commons.caching.CacheController -import fr.free.nrw.commons.mwapi.CategoryApi -import org.junit.Before -import org.junit.Test -import org.mockito.InjectMocks -import org.mockito.Mock -import org.mockito.MockitoAnnotations -import javax.inject.Inject -import javax.inject.Named - -import java.io.FileInputStream -import java.io.FileOutputStream - -class FileProcessorTest { - - @Mock - internal var cacheController: CacheController? = null - @Mock - internal var gpsCategoryModel: GpsCategoryModel? = null - @Mock - internal var apiCall: CategoryApi? = null - @Mock - @field:[Inject Named("default_preferences")] - internal var prefs: SharedPreferences? = null - - @InjectMocks - var fileProcessor: FileProcessor? = null - - @Before - fun setup() { - MockitoAnnotations.initMocks(this) - } - - @Test - fun processFileCoordinates() { - - } - - /** - * Test method to verify redaction Exif metadata - */ - @Test - fun redactExifTags() { - /* - val filePathRef: String? = "src/test/data/exif_redact_sample.jpg" - val filePathTmp: String? = "" + System.getProperty("java.io.tmpdir") + "exif_redact_sample_tmp.jpg" - - val inStream = FileInputStream(filePathRef) - val outStream = FileOutputStream(filePathTmp) - val inChannel = inStream.getChannel() - val outChannel = outStream.getChannel() - inChannel.transferTo(0, inChannel.size(), outChannel) - inStream.close() - outStream.close() - - val redactTags = mutableSetOf("Author", "Copyright", "Location", "Camera Model", - "Lens Model", "Serial Numbers", "Software") - - val exifInterface : ExifInterface? = ExifInterface(filePathTmp.toString()) - - var nonEmptyTag = false - for (redactTag in redactTags) { - for (tag in FileMetadataUtils.getTagsFromPref(redactTag)) { - val tagValue = exifInterface?.getAttribute(tag) - if(tagValue != null) { - nonEmptyTag = true - break - } - } - if (nonEmptyTag) break - } - // all tags are empty, can't test redaction - assert(nonEmptyTag) - - FileProcessor.redactExifTags(exifInterface, redactTags) - - for (redactTag in redactTags) { - for (tag in FileMetadataUtils.getTagsFromPref(redactTag)) { - val oldValue = exifInterface?.getAttribute(tag) - assert(oldValue == null) - } - } - */ - } -} \ No newline at end of file