summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java8
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/ProviderTest.java2
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java14
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java4
4 files changed, 17 insertions, 11 deletions
diff --git a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
index c6f4db38..c7c85f8d 100644
--- a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
+++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
@@ -51,15 +51,18 @@ public class TestSetupHelper {
public static Provider getConfiguredProvider() throws IOException, JSONException {
- return getProvider(null, null, null, null, null);
+ return getProvider(null, null, null, null, null, null);
}
- public static Provider getProvider(String domain, String providerIp, String caCertFile, String providerJson, String eipServiceJson) {
+ public static Provider getProvider(String domain, String providerIp, String providerApiIp, String caCertFile, String providerJson, String eipServiceJson) {
if (domain == null)
domain = "https://riseup.net";
if (providerIp == null) {
providerIp = "";
}
+ if (providerApiIp == null) {
+ providerApiIp = "";
+ }
if (caCertFile == null)
caCertFile = "riseup.net.pem";
if (providerJson == null)
@@ -72,6 +75,7 @@ public class TestSetupHelper {
Provider p = new Provider(
domain,
providerIp,
+ providerApiIp,
getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(caCertFile)),
getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(providerJson))
diff --git a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java b/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java
index bb809a79..0f9d358e 100644
--- a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java
@@ -54,6 +54,7 @@ public class ProviderTest {
null,
null,
null,
+ null,
"ptdemo.bitmask.eip-service.json");
assertTrue(p1.supportsPluggableTransports());
}
@@ -65,6 +66,7 @@ public class ProviderTest {
null,
null,
null,
+ null,
"eip-service-two-gateways.json");
assertFalse(p1.supportsPluggableTransports());
}
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
index 4d48372c..417c4bfc 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
@@ -107,7 +107,7 @@ public class GatewaysManagerTest {
@Test
public void testGatewayManagerFromCurrentProvider_misconfiguredProvider_noGateways() throws IOException, NullPointerException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_misconfigured_gateway.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_misconfigured_gateway.json");
MockHelper.mockProviderObserver(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
assertEquals(0, gatewaysManager.size());
@@ -115,7 +115,7 @@ public class GatewaysManagerTest {
@Test
public void testGatewayManagerFromCurrentProvider_threeGateways() {
- Provider provider = getProvider(null, null, null, null, "ptdemo_three_mixed_gateways.json");
+ Provider provider = getProvider(null, null, null,null, null, "ptdemo_three_mixed_gateways.json");
MockHelper.mockProviderObserver(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
assertEquals(3, gatewaysManager.size());
@@ -123,7 +123,7 @@ public class GatewaysManagerTest {
@Test
public void TestGetPosition_VpnProfileExtistingObfs4_returnPositionZero() throws JSONException, ConfigParser.ConfigParseError, IOException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_three_mixed_gateways.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_three_mixed_gateways.json");
JSONObject eipServiceJson = provider.getEipServiceJson();
JSONObject gateway1 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(0);
MockHelper.mockProviderObserver(provider);
@@ -140,7 +140,7 @@ public class GatewaysManagerTest {
@Test
public void TestGetPosition_VpnProfileExtistingOpenvpn_returnPositionZero() throws JSONException, ConfigParser.ConfigParseError, IOException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_three_mixed_gateways.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_three_mixed_gateways.json");
JSONObject eipServiceJson = provider.getEipServiceJson();
JSONObject gateway1 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(0);
MockHelper.mockProviderObserver(provider);
@@ -157,7 +157,7 @@ public class GatewaysManagerTest {
@Test
public void TestGetPosition_VpnProfileDifferentIp_returnMinusOne() throws JSONException, ConfigParser.ConfigParseError, IOException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_three_mixed_gateways.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_three_mixed_gateways.json");
JSONObject eipServiceJson = provider.getEipServiceJson();
JSONObject gateway1 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(0);
MockHelper.mockProviderObserver(provider);
@@ -174,7 +174,7 @@ public class GatewaysManagerTest {
@Test
public void TestGetPosition_VpnProfileMoscow_returnOne() throws JSONException, ConfigParser.ConfigParseError, IOException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_three_mixed_gateways.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_three_mixed_gateways.json");
JSONObject eipServiceJson = provider.getEipServiceJson();
JSONObject gateway1 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(1);
MockHelper.mockProviderObserver(provider);
@@ -191,7 +191,7 @@ public class GatewaysManagerTest {
@Test
public void TestSelectN_selectFirstObfs4Connection_returnThirdGateway() throws JSONException, ConfigParser.ConfigParseError, IOException {
- Provider provider = getProvider(null, null, null, null, "ptdemo_two_openvpn_one_pt_gateways.json");
+ Provider provider = getProvider(null, null, null, null, null, "ptdemo_two_openvpn_one_pt_gateways.json");
JSONObject eipServiceJson = provider.getEipServiceJson();
JSONObject gateway3 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(2);
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 1120c0da..94f7b9de 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
@@ -281,7 +281,7 @@ public class ProviderApiManagerTest {
@Test
public void test_handleIntentSetupProvider_preseededProviderAndCA_outdatedCertificate() throws IOException, CertificateEncodingException, NoSuchAlgorithmException, JSONException {
- Provider provider = getProvider(null ,null, "outdated_cert.pem", null, null);
+ Provider provider = getProvider(null ,null, null, "outdated_cert.pem", null, null);
mockProviderApiConnector(NO_ERROR);
providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback());
@@ -398,7 +398,7 @@ public class ProviderApiManagerTest {
@Test
public void test_handleIntentSetupProvider_outdatedPreseededProviderAndCA_successfulConfiguration() throws IOException, CertificateEncodingException, NoSuchAlgorithmException, JSONException {
- Provider provider = getProvider(null, null, null, "riseup_net_outdated_config.json", null);
+ Provider provider = getProvider(null, null, null, null, "riseup_net_outdated_config.json", null);
mockFingerprintForCertificate(" a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494");
mockProviderApiConnector(NO_ERROR);