diff options
author | cyBerta <cyberta@riseup.net> | 2024-06-26 16:52:16 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-06-26 16:52:16 +0200 |
commit | 371ce52aca4e57f27e8a16c38e88f818ec420d89 (patch) | |
tree | 52d908a5698754a8e2c09aa12953ae7bc36e3400 /app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java | |
parent | d2b2fc3b1b6c4d723ba112e911bfc972ea6aa3e6 (diff) |
fix tests after breaking change how we start obfsvpn in conjunction with openvpn, switching for socks proxying to transparent proxying
Diffstat (limited to 'app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
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 d66fedbe..9286a787 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java @@ -3,6 +3,7 @@ package se.leap.bitmaskclient.eip; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNull; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; @@ -23,6 +24,7 @@ import org.json.JSONException; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; +import org.junit.function.ThrowingRunnable; import org.mockito.Answers; import org.mockito.Mock; @@ -120,6 +122,21 @@ public class GatewaysManagerTest { } @Test + public void TestGetPosition_IncompatibleProviderBridges_returnParseError() throws JSONException, ConfigParser.ConfigParseError, IOException { + Provider provider = getProvider(null, null, null, null, null, null, "ptdemo.bitmask.eip-service.json", null); + JSONObject eipServiceJson = provider.getEipServiceJson(); + JSONObject gateway1 = eipServiceJson.getJSONArray(GATEWAYS).getJSONObject(0); + providerObservable.updateProvider(provider); + GatewaysManager gatewaysManager = new GatewaysManager(mockContext); + + VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration(); + configuration.apiVersion = 3; + configuration.remoteGatewayIP = "37.218.247.60"; + VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration); + assertThrows(ConfigParser.ConfigParseError.class, () -> configGenerator.createProfile(OBFS4)); + } + + @Test public void TestGetPosition_VpnProfileExistingObfs4FromPresortedList_returnsPositionOne() throws JSONException, ConfigParser.ConfigParseError, IOException { Provider provider = getProvider(null, null, null, null, null, null, "ptdemo_three_mixed_gateways.json", "ptdemo_three_mixed_gateways.geoip.json"); JSONObject eipServiceJson = provider.getEipServiceJson(); |