Add sha1Bool test with mock SHA1

This commit is contained in:
misaochan 2016-12-09 17:05:11 +13:00
parent 03f207db16
commit 16877eca27

View file

@ -31,6 +31,7 @@ import java.util.List;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.EventLog;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.auth.AuthenticatedActivity;
import fr.free.nrw.commons.auth.WikiAccountAuthenticator;
import fr.free.nrw.commons.category.CategorizationFragment;
@ -241,9 +242,14 @@ public class ShareActivity
mediaUriString = mediaUri.toString();
ImageLoader.getInstance().displayImage(mediaUriString, backgroundImageView);
//Test SHA1 of image
try {
InputStream inputStream = getContentResolver().openInputStream(mediaUri);
Log.d(TAG, "Input stream created from " + mediaUriString);
boolean sha1Bool = Utils.testSHA1("801957214aba50cb63bb6eb1b0effa50188900ba", inputStream);
Log.d(TAG, "SHA1Bool returns " + sha1Bool);
} catch (IOException e) {
Log.d(TAG, "IO Exception: ", e);
}