From 7263914f672d970f48ee500cbd956fff2ee4d537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 21 Mar 2023 11:45:22 +0100 Subject: [PATCH] Remove the Apple specific auth service tests These tests are doing real network requests towards hosts that are not under our control. --- .../AuthenticationServiceTests.swift | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 bindings/apple/Tests/MatrixRustSDKTests/AuthenticationServiceTests.swift diff --git a/bindings/apple/Tests/MatrixRustSDKTests/AuthenticationServiceTests.swift b/bindings/apple/Tests/MatrixRustSDKTests/AuthenticationServiceTests.swift deleted file mode 100644 index df92b6a32..000000000 --- a/bindings/apple/Tests/MatrixRustSDKTests/AuthenticationServiceTests.swift +++ /dev/null @@ -1,64 +0,0 @@ -@testable import MatrixRustSDK -import XCTest - -class AuthenticationServiceTests: XCTestCase { - var service: AuthenticationService! - - override func setUp() { - service = AuthenticationService(basePath: FileManager.default.temporaryDirectory.path, - passphrase: nil, - customSlidingSyncProxy: nil) - } - - func testValidServers() { - XCTAssertNoThrow(try service.configureHomeserver(serverNameOrHomeserverUrl: "matrix.org")) - XCTAssertNoThrow(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://matrix.org")) - XCTAssertNoThrow(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://matrix.org/")) - } - - func testInvalidCharacters() { - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "hello!@$£%^world"), - "A server name with invalid characters should not succeed to build.") { error in - guard case AuthenticationError.InvalidServerName = error else { XCTFail("Expected invalid name error."); return } - } - } - - func textNonExistentDomain() { - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "somesillylinkthatdoesntexist.com"), - "A server name that doesn't exist should not succeed.") { error in - guard case AuthenticationError.Generic = error else { XCTFail("Expected generic error."); return } - } - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://somesillylinkthatdoesntexist.com"), - "A server URL that doesn't exist should not succeed.") { error in - guard case AuthenticationError.Generic = error else { XCTFail("Expected generic error."); return } - } - } - - func testValidDomainWithoutServer() { - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://google.com"), - "Google should not succeed as it doesn't host a homeserver.") { error in - guard case AuthenticationError.Generic = error else { XCTFail("Expected generic error."); return } - } - } - - func testServerWithoutSlidingSync() { - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "envs.net"), - "Envs should not succeed as it doesn't advertise a sliding sync proxy.") { error in - guard case AuthenticationError.SlidingSyncNotAvailable = error else { XCTFail("Expected sliding sync error."); return } - } - } - - func testHomeserverURL() { - XCTAssertThrowsError(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://matrix-client.matrix.org"), - "Directly using a homeserver should not succeed as a sliding sync proxy won't be found.") { error in - guard case AuthenticationError.SlidingSyncNotAvailable = error else { XCTFail("Expected sliding sync error."); return } - } - } - - func testHomeserverURLWithProxyOverride() { - service = AuthenticationService(basePath: FileManager.default.temporaryDirectory.path, - passphrase: nil, customSlidingSyncProxy: "https://slidingsync.proxy") - XCTAssertNoThrow(try service.configureHomeserver(serverNameOrHomeserverUrl: "https://matrix-client.matrix.org"), - "Directly using a homeserver should succeed what a custom sliding sync proxy has been set.") - } -}