diff options
author | cyBerta <cyberta@riseup.net> | 2018-02-18 12:08:37 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2018-02-18 12:08:37 +0100 |
commit | 732e1f23d1e00f28ea5e64869737ba2c34e1791e (patch) | |
tree | ba7bfeb72cc3171e4f9f7717118f8d88f7e6f8c1 | |
parent | 495fcff1b866d8c58c9b404700dc5f7cc5fd5a72 (diff) |
#8797 fix brokem tests
4 files changed, 57 insertions, 4 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java index 84f38086..2c7848bc 100644 --- a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java @@ -10,6 +10,9 @@ import se.leap.bitmaskclient.testutils.MockSharedPreferences; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; +import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; +import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; +import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString; /** @@ -48,6 +51,9 @@ public class ConfigHelperTest { .putString(Provider.KEY, getInputAsString(getClass().getClassLoader().getResourceAsStream("riseup.net.json"))) .putString(Provider.MAIN_URL, "https://riseup.net") .putString(Provider.CA_CERT, getInputAsString(getClass().getClassLoader().getResourceAsStream("riseup.net.pem"))) + .putString(PROVIDER_EIP_DEFINITION, getInputAsString(getClass().getClassLoader().getResourceAsStream("eip-service-two-gateways.json"))) + .putString(PROVIDER_VPN_CERTIFICATE, getInputAsString(getClass().getClassLoader().getResourceAsStream("riseup.net.vpn_cert.pem"))) + .putString(PROVIDER_PRIVATE_KEY, getInputAsString(getClass().getClassLoader().getResourceAsStream("private_rsa_key.pem"))) .apply(); Provider provider = ConfigHelper.getSavedProviderFromSharedPreferences(mockPreferences); assertTrue(provider.isConfigured()); 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 0121f7aa..4842d170 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java @@ -269,7 +269,7 @@ public class ProviderApiManagerTest { Bundle expectedResult = mockBundle(); expectedResult.putBoolean(BROADCAST_RESULT_KEY, false); - expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_VPN_CERTIFICATE\",\"errors\":\"Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); + expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_CERTIFICATE\",\"errors\":\"Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); expectedResult.putParcelable(PROVIDER_KEY, provider); Intent providerApiCommand = mockIntent(); @@ -292,7 +292,7 @@ public class ProviderApiManagerTest { Bundle expectedResult = mockBundle(); expectedResult.putBoolean(BROADCAST_RESULT_KEY, false); - expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_VPN_CERTIFICATE\",\"errors\":\"Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); + expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_CERTIFICATE\",\"errors\":\"Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); expectedResult.putParcelable(PROVIDER_KEY, provider); Intent providerApiCommand = mockIntent(); @@ -315,7 +315,7 @@ public class ProviderApiManagerTest { providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback()); Bundle expectedResult = mockBundle(); expectedResult.putBoolean(BROADCAST_RESULT_KEY, false); - expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_VPN_CERTIFICATE\",\"errors\":\"Stored provider certificate is invalid. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); + expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_CERTIFICATE\",\"errors\":\"Stored provider certificate is invalid. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); expectedResult.putParcelable(PROVIDER_KEY, provider); Intent providerApiCommand = mockIntent(); @@ -340,7 +340,7 @@ public class ProviderApiManagerTest { Bundle expectedResult = mockBundle(); expectedResult.putBoolean(BROADCAST_RESULT_KEY, false); - expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_VPN_CERTIFICATE\",\"errors\":\"Stored provider certificate is invalid. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); + expectedResult.putString(ERRORS, "{\"errorId\":\"ERROR_INVALID_CERTIFICATE\",\"errors\":\"Stored provider certificate is invalid. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.\"}"); expectedResult.putParcelable(PROVIDER_KEY, provider); Intent providerApiCommand = mockIntent(); diff --git a/app/src/test/resources/private_rsa_key.pem b/app/src/test/resources/private_rsa_key.pem new file mode 100644 index 00000000..dd60e663 --- /dev/null +++ b/app/src/test/resources/private_rsa_key.pem @@ -0,0 +1,24 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDKIkAutGIS7YIMdOGlSmjme7Zi +PX/Py+MVSe6rnl36gh2d5yXuzA0+8LYD/GdYboVc8clriP0Y1EQZ+KkIGjWRvWOFIyPSQzIKaz10 +93mw3FUrgSubysRaqscs3T81YCHO+7ffJK97eqOP9HKW3Q4oDlcuWPG9HgP1Vq6qhXS1AHNryp+a +LoLmjiUyhBoDYOAyy3x2vMMMGXJ2XzWwbFwC15mgGf2L0+nCVyy0OymQay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IPmcmfnffGtko/4LXFUYgni+csF51R0NIaBw3x7N4pXI +elCIkKRj6D5vnHV2xq3hOPgUx9V2RmBss12RYTCwje0/MYyR4X1JsSeJ+/d2lEeXUjh8adQLetHP +HekCgYBsGFUmm2G3CdXArGRk2vJimqmUdYOBezaYoQrAb8iw7trpQ+s2tIzAeeSmT6tGo7mmFdAe +Sa96iH5R4cEMXKAJy7ik8Dj/vl5G77xcBiPOcz2K61jf5PySeXp2TsK8DEzjmRKuNKv/Fw1bZ6JF +tvMXYGoy6YumMdJykQ1pwq00cw== +-----END RSA PRIVATE KEY-----
\ No newline at end of file diff --git a/app/src/test/resources/riseup.net.vpn_cert.pem b/app/src/test/resources/riseup.net.vpn_cert.pem new file mode 100644 index 00000000..e3040033 --- /dev/null +++ b/app/src/test/resources/riseup.net.vpn_cert.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIEmzCCAoOgAwIBAgIQUX5qjwlLDM2OyZ7TduhvrDANBgkqhkiG9w0BAQsFADB1MRgwFgYDVQQK +DA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDE8MDoGA1UEAwwz +UmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EgKGNsaWVudCBjZXJ0aWZpY2F0ZXMgb25seSEpMB4XDTE4 +MDExODAwMDAwMFoXDTE4MDQxODAwMDAwMFowLTErMCkGA1UEAwwiVU5MSU1JVEVENjh4amVsMGZx +MnRzbmk0MGlxanQyZTYwbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMoiQC60YhLt +ggx04aVKaOZ7tmI9f8/L4xVJ7queXfqCHZ3nJe7MDT7wtgP8Z1huhVzxyWuI/RjURBn4qQgaNZG9 +Y4UjI9JDMgprPXT3ebDcVSuBK5vKxFqqxyzdPzVgIc77t98kr3t6o4/0cpbdDigOVy5Y8b0eA/VW +rqqFdLUAc2vKn5ouguaOJTKEGgNg4DLLfHa8wwwZcnZf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