-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor URLSession out of outgoing connection proxy tests
- Loading branch information
Jon Petersson
committed
Nov 16, 2023
1 parent
04c6609
commit 110dddd
Showing
6 changed files
with
83 additions
and
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// URLSessionProtocol.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2023-11-16. | ||
// Copyright © 2023 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol URLSessionProtocol { | ||
func data(from url: URL) async throws -> (Data, URLResponse) | ||
} | ||
|
||
extension URLSession: URLSessionProtocol {} |
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
// | ||
// MockURLSession.swift | ||
// MullvadVPNTests | ||
// | ||
// Created by Mojgan on 2023-10-25. | ||
// Copyright © 2023 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
class MockURLSession: URLSessionProtocol { | ||
var response: (Data, URLResponse) | ||
|
||
init(response: (Data, URLResponse)) { | ||
self.response = response | ||
} | ||
|
||
func data(from url: URL) async throws -> (Data, URLResponse) { | ||
return response | ||
} | ||
} |
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