diff options
Diffstat (limited to 'app/src/test/java/se/leap/bitmaskclient/testutils')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java index 1b94042e..5434e7bd 100644 --- a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java +++ b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java @@ -10,7 +10,6 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.powermock.api.mockito.PowerMockito.mockStatic; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_MOTD; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_MOTD_HASHES; @@ -21,7 +20,6 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICA import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getEipDefinitionFromPreferences; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -30,9 +28,6 @@ import android.os.Bundle; import android.os.Parcelable; import android.os.ResultReceiver; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - import org.json.JSONException; import org.json.JSONObject; import org.mockito.Mockito; @@ -47,17 +42,9 @@ import java.math.BigInteger; import java.net.UnknownHostException; import java.security.interfaces.RSAPrivateKey; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Base64; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Set; -import java.util.Vector; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicBoolean; import okhttp3.OkHttpClient; import se.leap.bitmaskclient.R; @@ -65,16 +52,14 @@ import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.base.utils.CertificateHelper; import se.leap.bitmaskclient.base.utils.FileHelper; -import se.leap.bitmaskclient.base.utils.InputStreamHelper; import se.leap.bitmaskclient.base.utils.BuildConfigHelper; import se.leap.bitmaskclient.base.utils.PreferenceHelper; -import se.leap.bitmaskclient.base.utils.RSAHelper; +import se.leap.bitmaskclient.base.utils.PrivateKeyHelper; import se.leap.bitmaskclient.providersetup.ProviderApiConnector; import se.leap.bitmaskclient.providersetup.connectivity.DnsResolver; import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator; import se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider; import se.leap.bitmaskclient.testutils.matchers.BundleMatcher; -import se.leap.bitmaskclient.tor.TorStatusObservable; /** * Created by cyberta on 29.01.18. @@ -160,8 +145,8 @@ public class MockHelper { return new FileHelper(new MockFileHelper(mockedFile)); } - public static RSAHelper mockRSAHelper() { - return new RSAHelper(rsaKeyString -> new RSAPrivateKey() { + public static PrivateKeyHelper mockPrivateKeyHelper() { + return new PrivateKeyHelper(rsaKeyString -> new RSAPrivateKey() { @Override public BigInteger getPrivateExponent() { return BigInteger.TEN; @@ -237,7 +222,7 @@ public class MockHelper { PreferenceHelper preferenceHelper = new PreferenceHelper(sharedPreferences); sharedPreferences.edit(). - putString(PROVIDER_PRIVATE_KEY, providerFromPrefs.getPrivateKey()). + putString(PROVIDER_PRIVATE_KEY, providerFromPrefs.getPrivateKeyString()). putString(PROVIDER_VPN_CERTIFICATE, providerFromPrefs.getVpnCertificate()). putString(Provider.KEY, providerFromPrefs.getDefinitionString()). putString(Provider.CA_CERT_FINGERPRINT, providerFromPrefs.getCaCertFingerprint()). @@ -257,7 +242,7 @@ public class MockHelper { PreferenceHelper preferenceHelper = new PreferenceHelper(sharedPreferences); sharedPreferences.edit(). - putString(PROVIDER_PRIVATE_KEY, provider.getPrivateKey()). + putString(PROVIDER_PRIVATE_KEY, provider.getPrivateKeyString()). putString(PROVIDER_VPN_CERTIFICATE, provider.getVpnCertificate()). putString(Provider.KEY, provider.getDefinitionString()). putString(Provider.CA_CERT_FINGERPRINT, provider.getCaCertFingerprint()). |