refactor cert handling for Android (preparing for v2 changes)

This commit is contained in:
Sefa Ilkimen
2018-04-11 03:24:27 +02:00
parent 32fdf49d31
commit 2ae4c7cf39
4 changed files with 150 additions and 168 deletions
+11
View File
@@ -437,6 +437,17 @@ const tests = [
validationFunc: function(driver, result) {
result.type.should.be.equal('resolved');
}
},{
description: 'should reject when pinned cert does not match received server cert (GET)',
expected: 'rejected: {"status": -1 ...',
before: helpers.enableSSLPinning,
func: function(resolve, reject) {
cordova.plugin.http.get('https://sha512.badssl.com/', {}, {}, resolve, reject);
},
validationFunc: function(driver, result, targetInfo) {
result.type.should.be.equal('rejected');
result.data.should.be.eql({ status: -1, error: targetInfo.isAndroid ? 'SSL handshake failed' : 'cancelled' });
}
},{
description: 'should send deeply structured JSON object correctly (POST) #65',
expected: 'resolved: {"status": 200, "data": "{\\"data\\": \\"{\\\\"outerObj\\\\":{\\\\"innerStr\\\\":\\\\"testString\\\\",\\\\"innerArr\\\\":[1,2,3]}}\\" ...',