diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 15:07:40 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 15:07:40 +0200 |
| commit | 2a619ceba75a4c16b25de12d59a87eac795a4468 (patch) | |
| tree | 1d63a35217011fa761b703633b3f91fd839ec71e /wrappers/swift/Tests | |
| parent | 7e309b67de74fe5bd5a1c70c1880c2a381c4f78b (diff) | |
Remove: unused wrappers
Diffstat (limited to 'wrappers/swift/Tests')
| -rw-r--r-- | wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift b/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift deleted file mode 100644 index bd2eabd..0000000 --- a/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift +++ /dev/null @@ -1,60 +0,0 @@ -import XCTest -@testable import EduVpnCommon - -final class EduVpnCommonTests: XCTestCase { - private static let testDataDir = "../../src/test_data" - - override class func setUp() { - // Swift is confused by CRLF, so on some systems we cannot just take the second-to-last element - InsecureTestingSetExtraKey(keyString: try! String(contentsOfFile: "\(testDataDir)/public.key") - .components(separatedBy: .newlines).last(where: { !$0.isEmpty })!) - } - - func testValid() throws { - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 10)) - } - - func testInvalidSignature() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/random.txt")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrInvalidSignature)}); - } - - func testWrongKey() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.wrong_key.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrInvalidSignatureUnknownKey)}); - } - - func testOldSignature() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 11)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrTooOld)}); - } - - func testUnknownExpectedFile() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/other_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/other_list.json")), - expectedFileName: "other_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrUnknownExpectedFileName)}); - } -} |
