mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
888 B
Swift
25 lines
888 B
Swift
5 years ago
|
import CryptoSwift
|
||
5 years ago
|
import PromiseKit
|
||
5 years ago
|
@testable import SignalServiceKit
|
||
|
import XCTest
|
||
|
|
||
|
class OnionRequestAPITests : XCTestCase {
|
||
5 years ago
|
private let maxRetryCount: UInt = 2 // Be a bit more stringent when testing
|
||
|
private let testPublicKey = "0501da4723331eb54aaa9a6753a0a59f762103de63f1dc40879cb65a5b5f508814"
|
||
|
|
||
5 years ago
|
func testOnionRequestSending() {
|
||
|
let semaphore = DispatchSemaphore(value: 0)
|
||
5 years ago
|
var error: Error? = nil
|
||
|
LokiAPI.useOnionRequests = true
|
||
|
let _ = attempt(maxRetryCount: maxRetryCount, recoveringOn: LokiAPI.workQueue) { [testPublicKey = self.testPublicKey] in
|
||
|
LokiAPI.getSwarm(for: testPublicKey)
|
||
|
}.done(on: LokiAPI.workQueue) { _ in
|
||
5 years ago
|
semaphore.signal()
|
||
5 years ago
|
}.catch(on: LokiAPI.workQueue) {
|
||
|
error = $0; semaphore.signal()
|
||
5 years ago
|
}
|
||
|
semaphore.wait()
|
||
5 years ago
|
XCTAssert(error == nil)
|
||
5 years ago
|
}
|
||
5 years ago
|
}
|