diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-02-13 11:31:18 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-02-13 11:31:18 +0100 |
commit | 3cc60ff642134e7442500e309c6b1248c819c0e8 (patch) | |
tree | 894e21a8863c1b53976c2d7948a5dc60381d937c /app/src/test/java/se/leap/bitmaskclient/eip | |
parent | 710fdd182dc1a470c949f50701d3aace4d67134c (diff) |
8827 - add ProviderTest & DefaultedURLTest
Diffstat (limited to 'app/src/test/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java index b0953493..4842d170 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java @@ -25,7 +25,6 @@ import android.os.Bundle; import android.text.TextUtils; import org.json.JSONException; -import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -36,7 +35,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import java.io.IOException; -import java.net.URL; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateEncodingException; @@ -64,7 +62,9 @@ import static se.leap.bitmaskclient.testutils.MockHelper.mockProviderApiConnecto import static se.leap.bitmaskclient.testutils.MockHelper.mockResources; import static se.leap.bitmaskclient.testutils.MockHelper.mockResultReceiver; import static se.leap.bitmaskclient.testutils.MockHelper.mockTextUtils; +import static se.leap.bitmaskclient.testutils.TestSetupHelper.getConfiguredProvider; import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString; +import static se.leap.bitmaskclient.testutils.TestSetupHelper.getProvider; /** @@ -108,32 +108,6 @@ public class ProviderApiManagerTest { mockResources = mockResources(getClass().getClassLoader().getResourceAsStream("error_messages.json")); } - private Provider getConfiguredProvider() throws IOException, JSONException { - return getProvider(null, null, null); - } - - private Provider getProvider(String domain, String caCertFile, String jsonFile) { - if (domain == null) - domain = "https://riseup.net"; - if (caCertFile == null) - caCertFile = "riseup.net.pem"; - if (jsonFile == null) - jsonFile = "riseup.net.json"; - - try { - return new Provider( - new URL(domain), - getInputAsString(getClass().getClassLoader().getResourceAsStream(caCertFile)), - getInputAsString(getClass().getClassLoader().getResourceAsStream(jsonFile)) - - ); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - @Test public void test_handleIntentSetupProvider_noProviderMainURL() throws IOException, JSONException { Provider provider = new Provider(""); |