diff options
author | cyberta <cyberta@riseup.net> | 2022-08-06 18:37:13 +0000 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2022-08-06 18:37:13 +0000 |
commit | b1cb49a2f78c80db0b3fa037a0b4e3c1c9c7dd61 (patch) | |
tree | 77effd84682014db0db950113cab239fa4370dc4 /app/src/test/java/se/leap | |
parent | 3bdbe09ffd7f4039f37af93b0da6b0965e09e0bd (diff) | |
parent | 598105bbaa383b27cadb682b76cdf00e5ad58369 (diff) |
Merge branch 'update_obfuscation_pinning_defaults' into 'master'
Update obfuscation pinning defaults
See merge request leap/bitmask_android!204
Diffstat (limited to 'app/src/test/java/se/leap')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/base/models/GatewayJsonTest.java | 29 | ||||
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java | 6 |
2 files changed, 32 insertions, 3 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/base/models/GatewayJsonTest.java b/app/src/test/java/se/leap/bitmaskclient/base/models/GatewayJsonTest.java new file mode 100644 index 00000000..61275378 --- /dev/null +++ b/app/src/test/java/se/leap/bitmaskclient/base/models/GatewayJsonTest.java @@ -0,0 +1,29 @@ +package se.leap.bitmaskclient.base.models; + +import static org.junit.Assert.assertEquals; +import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; +import static se.leap.bitmaskclient.eip.GatewaysManager.PINNED_OBFUSCATION_PROXY; + +import org.junit.Test; + +import de.blinkt.openvpn.core.connection.Connection; + +public class GatewayJsonTest { + + @Test + public void testToString() { + String gatewayJSON = "{\"location\":\"Unknown Location\",\"ip_address\":\"1.2.3.4\",\"host\":\"pinned.obfuscation.proxy\",\"capabilities\":{\"adblock\":false,\"filter_dns\":false,\"limited\":false,\"transport\":[{\"type\":\"obfs4\",\"protocols\":[\"tcp\"],\"ports\":[\"1194\"],\"options\":{\"cert\":\"xxxxxxx\",\"iatMode\":\"0\"}}],\"user_ips\":false}}"; + + Connection.TransportType transportType = OBFS4; + Transport[] transports = new Transport[]{ + new Transport(transportType.toString(), + new String[]{"tcp"}, + new String[]{"1194"}, + "xxxxxxx")}; + GatewayJson.Capabilities capabilities = new GatewayJson.Capabilities(false, false, false, transports, false); + GatewayJson gatewayJson = new GatewayJson("Unknown Location", "1.2.3.4", null, PINNED_OBFUSCATION_PROXY, capabilities); + + assertEquals(gatewayJSON, gatewayJson.toString()); + } + +}
\ No newline at end of file diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java index 86a287ad..4fb178fc 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java @@ -1726,7 +1726,7 @@ public class VpnConfigGeneratorTest { configuration.remoteGatewayIP = "1.2.3.4"; vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration); HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles(); - assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN)); + assertFalse("has no openvpn profile", vpnProfiles.containsKey(OPENVPN)); assertTrue("has obfs4 profile", vpnProfiles.containsKey(OBFS4)); assertFalse("has no obfs4 kcp profile", vpnProfiles.containsKey(OBFS4_KCP)); } @@ -1746,7 +1746,7 @@ public class VpnConfigGeneratorTest { vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration); HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles(); assertTrue("has obfs4_kcp profile", vpnProfiles.containsKey(OBFS4_KCP)); - assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN)); + assertFalse("has openvpn profile", vpnProfiles.containsKey(OPENVPN)); assertFalse("has no obfs4 profile", vpnProfiles.containsKey(OBFS4)); } @@ -1766,7 +1766,7 @@ public class VpnConfigGeneratorTest { vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration); HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles(); assertTrue("has obfs4_kcp profile", vpnProfiles.containsKey(OBFS4_KCP)); - assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN)); + assertFalse("has openvpn profile", vpnProfiles.containsKey(OPENVPN)); assertFalse("has no obfs4 profile", vpnProfiles.containsKey(OBFS4)); } |