Skip to content

Commit

Permalink
better testing cases
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlui committed Dec 25, 2015
1 parent fd86bf7 commit 5c04a2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Binary file not shown.
5 changes: 2 additions & 3 deletions PitayaTests/AddSSLPinning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ class AddSSLPinning: BaseTestCase {
let expectation = expectationWithDescription("testSSLPiningNotPassed")
var errorPinning = 0

Pita.build(HTTPMethod: .GET, url: "https://www.baidu.com/")
Pita.build(HTTPMethod: .GET, url: "https://autolayout.club/")
.addSSLPinning(LocalCertData: self.certData, SSLValidateErrorCallBack: { () -> Void in
print("Under the Man-in-the-middle attack!")
errorPinning = 1
expectation.fulfill()
})
.onNetworkError({ (error) -> Void in
XCTAssertNotNil(error)
XCTAssert(errorPinning == 1, "Under the Man-in-the-middle attack")

expectation.fulfill()
})
.responseString { (string, response) -> Void in
XCTFail("shoud not run callback() after a Man-in-the-middle attack.")
Expand Down

0 comments on commit 5c04a2d

Please sign in to comment.