Skip to content

Commit 696a2a2

Browse files
committed
OHHTTPStubs v9.0.0
1 parent c7c3e9f commit 696a2a2

11 files changed

+34
-37
lines changed

Cartfile.private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 5.5
2-
github "linksmt/OHHTTPStubs" "563f48d3fab84ef04639649c770b00f4fa502cca"
2+
github "AliSoftware/OHHTTPStubs" ~> 9.0
33
github "mapbox/mapbox-events-ios" ~> 0.10

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "5.9.0"
2-
github "linksmt/OHHTTPStubs" "563f48d3fab84ef04639649c770b00f4fa502cca"
2+
github "AliSoftware/OHHTTPStubs" "9.0.0"
33
github "mapbox/mapbox-events-ios" "v0.10.5"
44
github "mapbox/turf-swift" "v1.1.0"
55
github "raphaelmor/Polyline" "v5.0.2"

Tests/MapboxDirectionsTests/AnnotationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import OHHTTPStubs
55

66
class AnnotationTests: XCTestCase {
77
override func tearDown() {
8-
OHHTTPStubs.removeAllStubs()
8+
HTTPStubs.removeAllStubs()
99
super.tearDown()
1010
}
1111

@@ -25,7 +25,7 @@ class AnnotationTests: XCTestCase {
2525
stub(condition: isHost("api.mapbox.com")
2626
&& containsQueryParams(queryParams)) { _ in
2727
let path = Bundle.module.path(forResource: "annotation", ofType: "json")
28-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
28+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
2929
}
3030

3131
let options = RouteOptions(coordinates: [

Tests/MapboxDirectionsTests/DirectionsCredentialsTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import XCTest
2-
#if !SWIFT_PACKAGE
3-
import OHHTTPStubs
42
@testable import MapboxDirections
53

64
class DirectionsCredentialsTests: XCTestCase {
@@ -18,4 +16,3 @@ class DirectionsCredentialsTests: XCTestCase {
1816
XCTAssertEqual(credentials.host, host)
1917
}
2018
}
21-
#endif

Tests/MapboxDirectionsTests/DirectionsTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DirectionsTests: XCTestCase {
3939
NSTimeZone.default = TimeZone(secondsFromGMT: 0)!
4040
}
4141
override func tearDown() {
42-
OHHTTPStubs.removeAllStubs()
42+
HTTPStubs.removeAllStubs()
4343
super.tearDown()
4444
}
4545

@@ -86,10 +86,10 @@ class DirectionsTests: XCTestCase {
8686
}
8787

8888
func testKnownBadResponse() {
89-
OHHTTPStubs.stubRequests(passingTest: { (request) -> Bool in
89+
HTTPStubs.stubRequests(passingTest: { (request) -> Bool in
9090
return request.url!.absoluteString.contains("https://api.mapbox.com/directions")
91-
}) { (_) -> OHHTTPStubsResponse in
92-
return OHHTTPStubsResponse(data: BadResponse.data(using: .utf8)!, statusCode: 413, headers: ["Content-Type" : "text/html"])
91+
}) { (_) -> HTTPStubsResponse in
92+
return HTTPStubsResponse(data: BadResponse.data(using: .utf8)!, statusCode: 413, headers: ["Content-Type" : "text/html"])
9393
}
9494
let expectation = self.expectation(description: "Async callback")
9595
let one = CLLocation(coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
@@ -112,10 +112,10 @@ class DirectionsTests: XCTestCase {
112112

113113
func testUnknownBadResponse() {
114114
let message = "Enhance your calm, John Spartan."
115-
OHHTTPStubs.stubRequests(passingTest: { (request) -> Bool in
115+
HTTPStubs.stubRequests(passingTest: { (request) -> Bool in
116116
return request.url!.absoluteString.contains("https://api.mapbox.com/directions")
117-
}) { (_) -> OHHTTPStubsResponse in
118-
return OHHTTPStubsResponse(data: message.data(using: .utf8)!, statusCode: 420, headers: ["Content-Type" : "text/plain"])
117+
}) { (_) -> HTTPStubsResponse in
118+
return HTTPStubsResponse(data: message.data(using: .utf8)!, statusCode: 420, headers: ["Content-Type" : "text/plain"])
119119
}
120120
let expectation = self.expectation(description: "Async callback")
121121
let one = CLLocation(coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
@@ -158,10 +158,10 @@ class DirectionsTests: XCTestCase {
158158
func testDownNetwork() {
159159
let notConnected = NSError(domain: NSURLErrorDomain, code: URLError.notConnectedToInternet.rawValue) as! URLError
160160

161-
OHHTTPStubs.stubRequests(passingTest: { (request) -> Bool in
161+
HTTPStubs.stubRequests(passingTest: { (request) -> Bool in
162162
return request.url!.absoluteString.contains("https://api.mapbox.com/directions")
163-
}) { (_) -> OHHTTPStubsResponse in
164-
return OHHTTPStubsResponse(error: notConnected)
163+
}) { (_) -> HTTPStubsResponse in
164+
return HTTPStubsResponse(error: notConnected)
165165
}
166166

167167
let expectation = self.expectation(description: "Async callback")

Tests/MapboxDirectionsTests/MatchTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import OHHTTPStubs
1212
class MatchTests: XCTestCase {
1313
override func tearDown() {
1414
#if !SWIFT_PACKAGE
15-
OHHTTPStubs.removeAllStubs()
15+
HTTPStubs.removeAllStubs()
1616
#endif
1717
super.tearDown()
1818
}
@@ -32,7 +32,7 @@ class MatchTests: XCTestCase {
3232
&& isMethodGET()
3333
&& pathStartsWith("/matching/v5/mapbox/driving")) { _ in
3434
let path = Bundle.module.path(forResource: "match", ofType: "json")
35-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
35+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
3636
}
3737

3838
var response: MapMatchingResponse!
@@ -121,7 +121,7 @@ class MatchTests: XCTestCase {
121121
&& isMethodGET()
122122
&& pathStartsWith("/matching/v5/mapbox/driving")) { _ in
123123
let path = Bundle.module.path(forResource: "null-tracepoint", ofType: "json")
124-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
124+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
125125
}
126126

127127
var response: MapMatchingResponse!

Tests/MapboxDirectionsTests/OfflineDirectionsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class OfflineDirectionsTests: XCTestCase {
2222
let filePath = URL(fileURLWithPath: path!)
2323
let data = try! Data(contentsOf: filePath)
2424
let jsonObject = try! JSONSerialization.jsonObject(with: data, options: [])
25-
return OHHTTPStubsResponse(jsonObject: jsonObject, statusCode: 200, headers: ["Content-Type": "application/json"])
25+
return HTTPStubsResponse(jsonObject: jsonObject, statusCode: 200, headers: ["Content-Type": "application/json"])
2626
}
2727

2828
directions.fetchAvailableOfflineVersions { (versions, error) in
2929
XCTAssertEqual(versions!.count, 1)
3030
XCTAssertEqual(versions!.first!, "2018-10-16")
3131

3232
versionsExpectation.fulfill()
33-
OHHTTPStubs.removeStub(apiStub)
33+
HTTPStubs.removeStub(apiStub)
3434
}
3535

3636
wait(for: [versionsExpectation], timeout: 2)
@@ -57,7 +57,7 @@ class OfflineDirectionsTests: XCTestCase {
5757
headers["Accept-Ranges"] = "bytes"
5858
headers["Content-Disposition"] = "attachment; filename=\"\(version).tar\""
5959

60-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: headers)
60+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: headers)
6161
}
6262

6363
directions.downloadTiles(in: bounds, version: version, completionHandler: { (url, response, error) in
@@ -66,7 +66,7 @@ class OfflineDirectionsTests: XCTestCase {
6666
XCTAssertNil(error)
6767

6868
downloadExpectation.fulfill()
69-
OHHTTPStubs.removeStub(apiStub)
69+
HTTPStubs.removeStub(apiStub)
7070
})
7171

7272
wait(for: [downloadExpectation], timeout: 60)

Tests/MapboxDirectionsTests/RoutableMatchTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import OHHTTPStubs
55

66
class RoutableMatchTest: XCTestCase {
77
override func tearDown() {
8-
OHHTTPStubs.removeAllStubs()
8+
HTTPStubs.removeAllStubs()
99
super.tearDown()
1010
}
1111

@@ -23,7 +23,7 @@ class RoutableMatchTest: XCTestCase {
2323
&& isMethodGET()
2424
&& pathStartsWith("/matching/v5/mapbox/driving")) { _ in
2525
let path = Bundle(for: type(of: self)).path(forResource: "match-polyline6", ofType: "json")
26-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
26+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
2727
}
2828

2929
var routeResponse: RouteResponse!

Tests/MapboxDirectionsTests/RouteRefreshTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RouteRefreshTests: XCTestCase {
1616
&& isMethodGET()
1717
&& pathStartsWith("/directions/v5/mapbox/driving-traffic")) { _ in
1818
let path = Bundle(for: type(of: self)).path(forResource: "routeRefreshRoute", ofType: "json")
19-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
19+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
2020
}
2121

2222
stub(condition: isHost("api.mapbox.com")
@@ -25,16 +25,16 @@ class RouteRefreshTests: XCTestCase {
2525
switch Int($0.url!.lastPathComponent)! {
2626
case 0...1:
2727
let path = Bundle(for: type(of: self)).path(forResource: "routeRefreshResponse", ofType: "json")
28-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
28+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
2929
default:
3030
let path = Bundle(for: type(of: self)).path(forResource: "incorrectRouteRefreshResponse", ofType: "json")
31-
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 422, headers: ["Content-Type": "application/json"])
31+
return HTTPStubsResponse(fileAtPath: path!, statusCode: 422, headers: ["Content-Type": "application/json"])
3232
}
3333
}
3434
}
3535

3636
override func tearDown() {
37-
OHHTTPStubs.removeAllStubs()
37+
HTTPStubs.removeAllStubs()
3838
super.tearDown()
3939
}
4040

Tests/MapboxDirectionsTests/V5Tests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Polyline
66

77
class V5Tests: XCTestCase {
88
override func tearDown() {
9-
OHHTTPStubs.removeAllStubs()
9+
HTTPStubs.removeAllStubs()
1010
super.tearDown()
1111
}
1212

@@ -31,7 +31,7 @@ class V5Tests: XCTestCase {
3131
let data = try! Data(contentsOf: filePath, options: [])
3232
let jsonObject = try! JSONSerialization.jsonObject(with: data, options: [])
3333
let transformedData = transformer?(jsonObject as! JSONDictionary) ?? jsonObject
34-
return OHHTTPStubsResponse(jsonObject: transformedData, statusCode: 200, headers: ["Content-Type": "application/json"])
34+
return HTTPStubsResponse(jsonObject: transformedData, statusCode: 200, headers: ["Content-Type": "application/json"])
3535
}
3636

3737
let options = RouteOptions(coordinates: [
@@ -227,7 +227,7 @@ class V5Tests: XCTestCase {
227227
let filePath = URL(fileURLWithPath: path!)
228228
let data = try! Data(contentsOf: filePath, options: [])
229229
let jsonObject = try! JSONSerialization.jsonObject(with: data, options: [])
230-
return OHHTTPStubsResponse(jsonObject: jsonObject, statusCode: 200, headers: ["Content-Type": "application/json"])
230+
return HTTPStubsResponse(jsonObject: jsonObject, statusCode: 200, headers: ["Content-Type": "application/json"])
231231
}
232232

233233
let waypoints = [

0 commit comments

Comments
 (0)