-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
637 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// MullvadMockData.h | ||
// MullvadMockData | ||
// | ||
// Created by Mojgan on 2024-05-03. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
//! Project version number for MullvadMockData. | ||
FOUNDATION_EXPORT double MullvadMockDataVersionNumber; | ||
|
||
//! Project version string for MullvadMockData. | ||
FOUNDATION_EXPORT const unsigned char MullvadMockDataVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <MullvadMockData/PublicHeader.h> | ||
|
||
|
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,52 @@ | ||
// | ||
// MockProxyFactory.swift | ||
// MullvadMockData | ||
// | ||
// Created by Mojgan on 2024-05-03. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import MullvadREST | ||
import MullvadTypes | ||
import WireGuardKitTypes | ||
|
||
public struct MockProxyFactory: ProxyFactoryProtocol { | ||
public var configuration: REST.AuthProxyConfiguration | ||
|
||
public func createAPIProxy() -> any APIQuerying { | ||
REST.APIProxy(configuration: configuration) | ||
} | ||
|
||
public func createAccountsProxy() -> any RESTAccountHandling { | ||
AccountsProxyStub(createAccountResult: .success(.mockValue())) | ||
} | ||
|
||
public func createDevicesProxy() -> any DeviceHandling { | ||
DevicesProxyStub(deviceResult: .success(Device.mock(publicKey: PrivateKey().publicKey))) | ||
} | ||
|
||
public static func makeProxyFactory( | ||
transportProvider: any RESTTransportProvider, | ||
addressCache: REST.AddressCache | ||
) -> any ProxyFactoryProtocol { | ||
let basicConfiguration = REST.ProxyConfiguration( | ||
transportProvider: transportProvider, | ||
addressCacheStore: addressCache | ||
) | ||
|
||
let authenticationProxy = REST.AuthenticationProxy( | ||
configuration: basicConfiguration | ||
) | ||
let accessTokenManager = REST.AccessTokenManager( | ||
authenticationProxy: authenticationProxy | ||
) | ||
|
||
let authConfiguration = REST.AuthProxyConfiguration( | ||
proxyConfiguration: basicConfiguration, | ||
accessTokenManager: accessTokenManager | ||
) | ||
|
||
return MockProxyFactory(configuration: authConfiguration) | ||
} | ||
} |
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
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
Oops, something went wrong.