From 015d8f9f512b5020d380aadf4af70a89a4b3dc42 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 1 Jul 2020 00:15:52 +0200 Subject: inject preshipped geoip url to provider object --- .../java/se.leap.bitmaskclient/testutils/TestSetupHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/src/sharedTest/java') 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 c7c85f8d..69fffcb4 100644 --- a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java +++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java @@ -51,12 +51,14 @@ public class TestSetupHelper { public static Provider getConfiguredProvider() throws IOException, JSONException { - return getProvider(null, null, null, null, null, null); + return getProvider(null, null, null, null, null, null, null); } - public static Provider getProvider(String domain, String providerIp, String providerApiIp, String caCertFile, String providerJson, String eipServiceJson) { + public static Provider getProvider(String domain, String geoipUrl, String providerIp, String providerApiIp, String caCertFile, String providerJson, String eipServiceJson) { if (domain == null) domain = "https://riseup.net"; + if (geoipUrl == null) + geoipUrl = "https://api.black.riseup.net:9001/json"; if (providerIp == null) { providerIp = ""; } @@ -74,6 +76,7 @@ public class TestSetupHelper { try { Provider p = new Provider( domain, + geoipUrl, providerIp, providerApiIp, getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(caCertFile)), -- cgit v1.2.3 From 4e861a972a28bd7eb268fb03c80b989a8b36c2a0 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 23 Jul 2020 17:41:26 +0200 Subject: adapt existing tests for geoipservice api --- .../java/se.leap.bitmaskclient/testutils/TestSetupHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/src/sharedTest/java') 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 69fffcb4..c741faf2 100644 --- a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java +++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java @@ -51,10 +51,10 @@ public class TestSetupHelper { public static Provider getConfiguredProvider() throws IOException, JSONException { - return getProvider(null, null, null, null, null, null, null); + return getProvider(null, null, null, null, null, null, null, null); } - public static Provider getProvider(String domain, String geoipUrl, String providerIp, String providerApiIp, String caCertFile, String providerJson, String eipServiceJson) { + public static Provider getProvider(String domain, String geoipUrl, String providerIp, String providerApiIp, String caCertFile, String providerJson, String eipServiceJson, String geoIpJson) { if (domain == null) domain = "https://riseup.net"; if (geoipUrl == null) @@ -72,6 +72,9 @@ public class TestSetupHelper { if (eipServiceJson == null) { eipServiceJson = "riseup.service.json"; } + if (geoIpJson == null) { + geoIpJson = "riseup.geoip.json"; + } try { Provider p = new Provider( @@ -86,6 +89,10 @@ public class TestSetupHelper { JSONObject eipServiceJsonObject = new JSONObject( getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(eipServiceJson))); p.setEipServiceJson(eipServiceJsonObject); + + JSONObject geoIpJsonObject = new JSONObject( + getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(geoIpJson))); + p.setGeoIpJson(geoIpJsonObject); return p; } catch (IOException | JSONException e) { e.printStackTrace(); -- cgit v1.2.3