summaryrefslogtreecommitdiff
path: root/app/src/sharedTest
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-02-13 16:06:49 +0100
committercyBerta <cyberta@riseup.net>2018-02-13 16:06:49 +0100
commita41e0b0f7ec0cff1dc7a34b42d663c777a317e61 (patch)
treeeba639ead30462f595614677a8358e972fd4cef1 /app/src/sharedTest
parentfecdec8975042d0ae27efe63e8cefc7415ca5ad6 (diff)
parent9b6c368a25510c462ea357121c97edb6d0310021 (diff)
Merge branch 'origin_0.9.8' into #8831_progress_animation_when_connecting
* added new EipCommand in StartActivity * added option to add intent extras to EipCommand * resolved merge conflicts and minor refactorings in: app/src/main/java/se/leap/bitmaskclient/EipFragment.java app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
Diffstat (limited to 'app/src/sharedTest')
-rw-r--r--app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java33
1 files changed, 33 insertions, 0 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 725924e6..a9584238 100644
--- a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
+++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
@@ -17,10 +17,17 @@
package se.leap.bitmaskclient.testutils;
+import junit.framework.Test;
+
+import org.json.JSONException;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.net.URL;
+
+import se.leap.bitmaskclient.Provider;
/**
* Created by cyberta on 08.10.17.
@@ -40,4 +47,30 @@ public class TestSetupHelper {
return sb.toString();
}
+
+ public static Provider getConfiguredProvider() throws IOException, JSONException {
+ return getProvider(null, null, null);
+ }
+
+ public static 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(TestSetupHelper.class.getClassLoader().getResourceAsStream(caCertFile)),
+ getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(jsonFile))
+
+ );
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
}