IOS-1542 Move BasicVerificationServiceTest. IOS-1542
authorDirk Zimmermann <dz@pep.security>
Mon, 15 Apr 2019 16:17:33 +0200
branchIOS-1542
changeset 8242aed53e6c0f3c
parent 8241 5cae4f720403
child 8243 024160b13bd1
IOS-1542 Move BasicVerificationServiceTest.
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOSTests/Service/BasicVerificationServiceTest.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Mon Apr 15 16:17:33 2019 +0200
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon Apr 15 16:17:33 2019 +0200
     1.3 @@ -314,6 +314,7 @@
     1.4  		43A469FA21513B10002E1036 /* PEPSwipeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A469F921513B10002E1036 /* PEPSwipeTableViewCell.swift */; };
     1.5  		43A5DE381D631D49001153AF /* UnencryptedHTMLMail.txt in Resources */ = {isa = PBXBuildFile; fileRef = 43A5DE371D631D49001153AF /* UnencryptedHTMLMail.txt */; };
     1.6  		43A60116226467410099B45C /* ConnectionTransport+Transport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A60115226467410099B45C /* ConnectionTransport+Transport.swift */; };
     1.7 +		43A6012A2264B5340099B45C /* BasicVerificationServiceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A601292264B5340099B45C /* BasicVerificationServiceTest.swift */; };
     1.8  		43A6E04B1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A6E04A1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift */; };
     1.9  		43A6E0581E57400E005BEE69 /* RatingReEvaluator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A6E0571E57400E005BEE69 /* RatingReEvaluator.swift */; };
    1.10  		43AA825B1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43AA825A1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift */; };
    1.11 @@ -833,6 +834,7 @@
    1.12  		43A469F921513B10002E1036 /* PEPSwipeTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PEPSwipeTableViewCell.swift; sourceTree = "<group>"; };
    1.13  		43A5DE371D631D49001153AF /* UnencryptedHTMLMail.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UnencryptedHTMLMail.txt; sourceTree = "<group>"; };
    1.14  		43A60115226467410099B45C /* ConnectionTransport+Transport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ConnectionTransport+Transport.swift"; sourceTree = "<group>"; };
    1.15 +		43A601292264B5340099B45C /* BasicVerificationServiceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicVerificationServiceTest.swift; sourceTree = "<group>"; };
    1.16  		43A6E04A1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReevaluateMessageRatingOperation.swift; sourceTree = "<group>"; };
    1.17  		43A6E0571E57400E005BEE69 /* RatingReEvaluator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RatingReEvaluator.swift; sourceTree = "<group>"; };
    1.18  		43AA825A1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentViewContainer.swift; sourceTree = "<group>"; };
    1.19 @@ -1823,6 +1825,7 @@
    1.20  				150707DD21006D0200AA213F /* UI */,
    1.21  				151F7202202A06D30057C74D /* Util */,
    1.22  				15F82A072006552B0084F9EA /* Tests from MessageModel in Exile due to Apple Bug */,
    1.23 +				43A601252264B5050099B45C /* Service */,
    1.24  				43980E401CBD0BCA00A7FC3C /* Info.plist */,
    1.25  				4336229D1DC76B8100133B3D /* MessageModelTests.swift */,
    1.26  				438D253B1D4B9E7500BFF7AA /* MimeTests.swift */,
    1.27 @@ -1916,6 +1919,14 @@
    1.28  			name = Raw;
    1.29  			sourceTree = "<group>";
    1.30  		};
    1.31 +		43A601252264B5050099B45C /* Service */ = {
    1.32 +			isa = PBXGroup;
    1.33 +			children = (
    1.34 +				43A601292264B5340099B45C /* BasicVerificationServiceTest.swift */,
    1.35 +			);
    1.36 +			path = Service;
    1.37 +			sourceTree = "<group>";
    1.38 +		};
    1.39  		43A6E0491E5726C8005BEE69 /* Background */ = {
    1.40  			isa = PBXGroup;
    1.41  			children = (
    1.42 @@ -3039,6 +3050,7 @@
    1.43  				00227E6A21635DED000D9BDB /* FilterViewModelTest.swift in Sources */,
    1.44  				437795C82154D6FD00CC62C2 /* PEPMessage+TestExtension.swift in Sources */,
    1.45  				153CA6E41FB60D99003C9629 /* DercyptMessagesOperationTest.swift in Sources */,
    1.46 +				43A6012A2264B5340099B45C /* BasicVerificationServiceTest.swift in Sources */,
    1.47  				151F71F7202A06760057C74D /* TestDataBase.swift in Sources */,
    1.48  				15BBBC681FD04DFC00B9DCC8 /* ReportingErrorContainerTest.swift in Sources */,
    1.49  				1541D7F01FC81ED900D52A5D /* URL+ExtensionsTest.swift in Sources */,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpForiOSTests/Service/BasicVerificationServiceTest.swift	Mon Apr 15 16:17:33 2019 +0200
     2.3 @@ -0,0 +1,45 @@
     2.4 +//
     2.5 +//  BasicVerificationServiceTest.swift
     2.6 +//  MessageModelTests
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 12.04.19.
     2.9 +//  Copyright © 2019 pEp Security S.A. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +import XCTest
    2.13 +
    2.14 +import MessageModel
    2.15 +
    2.16 +class TestDelegate: BasicVerificationServiceDelegate {
    2.17 +    private let expectation: XCTestExpectation
    2.18 +    public var error: Error?
    2.19 +
    2.20 +    init(expectation: XCTestExpectation) {
    2.21 +        self.expectation = expectation
    2.22 +    }
    2.23 +
    2.24 +    func verified(connectInfo: BasicConnectInfo, error: Error?,
    2.25 +                  service: BasicVerificationServiceProtocol) {
    2.26 +        self.error = error
    2.27 +        expectation.fulfill()
    2.28 +    }
    2.29 +}
    2.30 +
    2.31 +class BasicVerificationServiceTest: XCTestCase {
    2.32 +    override func setUp() {
    2.33 +    }
    2.34 +
    2.35 +    override func tearDown() {
    2.36 +    }
    2.37 +
    2.38 +    func test(service: inout BasicVerificationServiceProtocol,
    2.39 +              connectInfo: BasicConnectInfo,
    2.40 +              verify: (Error?) -> ()) {
    2.41 +        let expVerificationDone = expectation(description: "expVerificationDone")
    2.42 +        let myDelegate = TestDelegate(expectation: expVerificationDone)
    2.43 +        service.delegate = myDelegate
    2.44 +        service.verify(connectInfo: connectInfo)
    2.45 +        wait(for: [expVerificationDone], timeout: TestUtil.waitTime)
    2.46 +        verify(myDelegate.error)
    2.47 +    }
    2.48 +}