-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made it possible to change configuration of underlying URLSessionConf…
…iguration.
- Loading branch information
Christopher Bryan Henderson
committed
Oct 16, 2017
1 parent
f8c5ec6
commit 9241901
Showing
5 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// ClientInheritanceTests.swift | ||
// RetroluxTests | ||
// | ||
// Created by Christopher Bryan Henderson on 10/16/17. | ||
// Copyright © 2017 Bryan. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
import Retrolux | ||
|
||
class ClientInheritanceTests: XCTestCase { | ||
func testInheritance() { | ||
class TestHTTPClient: HTTPClient { | ||
override init() { | ||
super.init() | ||
let configuration = URLSessionConfiguration.default | ||
configuration.timeoutIntervalForRequest = 5349786 | ||
session = URLSession.init(configuration: configuration) | ||
} | ||
} | ||
|
||
let builder1 = Builder.dry() | ||
builder1.client = TestHTTPClient() | ||
let request1 = builder1.makeRequest(method: .post, endpoint: "endpoint", args: (), response: Void.self) | ||
_ = request1().perform() | ||
|
||
let builder2 = Builder.dry() | ||
builder2.client = HTTPClient() | ||
let request2 = builder2.makeRequest(method: .post, endpoint: "endpoint", args: (), response: Void.self) | ||
_ = request2().perform() | ||
|
||
let client1 = builder1.client as! HTTPClient | ||
XCTAssert(client1.session.configuration.timeoutIntervalForRequest == 5349786) | ||
let client2 = builder2.client as! HTTPClient | ||
XCTAssert(client2.session.configuration.timeoutIntervalForRequest != 5349786) | ||
} | ||
} |