Closed vadymmarkov closed 7 years ago
@JohnSundell I have troubles with mocking serverTrust
in URLProtectionSpace
, it's get only property. So I can add tests, but it's not gonna cover all the cases.
@vadymmarkov So the way I would do it is extract that property into a protocol (for example ServerTrustProvider
or similar), then mock that protocol in your tests. Would that work?
@JohnSundell It would work with protocol, but it's not that easy to create an instance of this SecTrust
type without valid certificate. And without that instance I can't really simulate the case when it's not nil
. I ended up with tests that partially cover this patch. https://github.com/hyperoslo/Malibu/pull/63/commits/543f8bd14549313124fb76a7c73e9383108ccd41
The way we handled authentication challenges doesn't handle all the cases, basically it worked only when there is a base URL. Now we do multiple validations and call
completionHandler
in the end of the delegate function.