IOS-1521 minimizes Record usage IOS-1521+IOS-1495
authorbuff <andreas@pep-project.org>
Tue, 14 May 2019 22:31:30 +0200
branchIOS-1521+IOS-1495
changeset 8617863f7380e2d8
parent 8616 a18e4cc9c07e
child 8618 6ee1f9a0b281
IOS-1521 minimizes Record usage
pEpForiOSTests/DecryptImportedMessagesTests.swift
pEpForiOSTests/DecryptionTestsInternal.swift
pEpForiOSTests/HandshakeTests.swift
pEpForiOSTests/MailParsingTests.swift
pEpForiOSTests/MessageReevalutionTests.swift
pEpForiOSTests/Models/SetOwnKeyViewModelTests.swift
pEpForiOSTests/PEPSessionTest.swift
pEpForiOSTests/ReplicationServiceTests.swift
pEpForiOSTests/SimpleOperationsTest.swift
pEpForiOSTests/TestUtils/CoreDataDrivenTestBase.swift
pEpForiOSTests/TestUtils/TestUtil.swift
     1.1 --- a/pEpForiOSTests/DecryptImportedMessagesTests.swift	Tue May 14 22:16:34 2019 +0200
     1.2 +++ b/pEpForiOSTests/DecryptImportedMessagesTests.swift	Tue May 14 22:31:30 2019 +0200
     1.3 @@ -30,7 +30,7 @@
     1.4          XCTAssertTrue(PEPUtil.pEpClean())
     1.5  
     1.6          persistentSetup = PersistentSetup()
     1.7 -        moc = Record.Context.default
     1.8 +        moc = Stack.shared.mainContext
     1.9  
    1.10          self.backgroundQueue = OperationQueue()
    1.11      }
     2.1 --- a/pEpForiOSTests/DecryptionTestsInternal.swift	Tue May 14 22:16:34 2019 +0200
     2.2 +++ b/pEpForiOSTests/DecryptionTestsInternal.swift	Tue May 14 22:31:30 2019 +0200
     2.3 @@ -39,7 +39,7 @@
     2.4  
     2.5          persistentSetup = PersistentSetup()
     2.6  
     2.7 -        moc = Record.Context.default
     2.8 +        moc = Stack.shared.mainContext
     2.9  
    2.10          let cdMyAccount = SecretTestData().createWorkingCdAccount(number: 0, context: moc)
    2.11          guard let myPepIdentity = pEpIdentity(cdAccount: cdMyAccount) else {
     3.1 --- a/pEpForiOSTests/HandshakeTests.swift	Tue May 14 22:16:34 2019 +0200
     3.2 +++ b/pEpForiOSTests/HandshakeTests.swift	Tue May 14 22:31:30 2019 +0200
     3.3 @@ -25,7 +25,7 @@
     3.4  
     3.5          XCTAssertTrue(PEPUtil.pEpClean())
     3.6          persistentSetup = PersistentSetup()
     3.7 -        moc = Record.Context.default
     3.8 +        moc = Stack.shared.mainContext
     3.9  
    3.10          let cdMyAccount = SecretTestData().createWorkingCdAccount(number: 0, context: moc)
    3.11          cdMyAccount.identity?.userName = "iOS Test 002"
     4.1 --- a/pEpForiOSTests/MailParsingTests.swift	Tue May 14 22:16:34 2019 +0200
     4.2 +++ b/pEpForiOSTests/MailParsingTests.swift	Tue May 14 22:31:30 2019 +0200
     4.3 @@ -7,9 +7,10 @@
     4.4  //
     4.5  
     4.6  import XCTest
     4.7 +import CoreData
     4.8  
     4.9  @testable import pEpForiOS
    4.10 -@testable import MessageModel //FIXME:
    4.11 +@testable import MessageModel
    4.12  import PEPObjCAdapterFramework
    4.13  
    4.14  class MailParsingTests: XCTestCase { //!!!: use BaseClass
    4.15 @@ -23,7 +24,7 @@
    4.16          XCTAssertTrue(PEPUtil.pEpClean())
    4.17          persistentSetup = PersistentSetup()
    4.18  
    4.19 -        let moc = Record.Context.default
    4.20 +        let moc: NSManagedObjectContext = Stack.shared.mainContext
    4.21  
    4.22          let cdMyAccount = SecretTestData().createWorkingCdAccount(number: 0, context: moc)
    4.23          cdMyAccount.identity?.userName = "iOS Test 002"
     5.1 --- a/pEpForiOSTests/MessageReevalutionTests.swift	Tue May 14 22:16:34 2019 +0200
     5.2 +++ b/pEpForiOSTests/MessageReevalutionTests.swift	Tue May 14 22:31:30 2019 +0200
     5.3 @@ -37,7 +37,7 @@
     5.4          XCTAssertTrue(PEPUtil.pEpClean())
     5.5  
     5.6          persistentSetup = PersistentSetup()
     5.7 -        moc = Record.Context.default
     5.8 +        moc = Stack.shared.mainContext
     5.9  
    5.10          let ownIdentity = PEPIdentity(address: "iostest002@peptest.ch",
    5.11                                        userID: "iostest002@peptest.ch_ID",
     6.1 --- a/pEpForiOSTests/Models/SetOwnKeyViewModelTests.swift	Tue May 14 22:16:34 2019 +0200
     6.2 +++ b/pEpForiOSTests/Models/SetOwnKeyViewModelTests.swift	Tue May 14 22:31:30 2019 +0200
     6.3 @@ -35,7 +35,7 @@
     6.4          XCTAssertTrue(PEPUtil.pEpClean())
     6.5  
     6.6          persistentSetup = PersistentSetup()
     6.7 -        moc = Record.Context.default
     6.8 +        moc = Stack.shared.mainContext
     6.9  
    6.10          self.backgroundQueue = OperationQueue()
    6.11      }
     7.1 --- a/pEpForiOSTests/PEPSessionTest.swift	Tue May 14 22:16:34 2019 +0200
     7.2 +++ b/pEpForiOSTests/PEPSessionTest.swift	Tue May 14 22:31:30 2019 +0200
     7.3 @@ -23,7 +23,7 @@
     7.4          super.setUp()
     7.5          XCTAssertTrue(PEPUtil.pEpClean())
     7.6          persistentSetup = PersistentSetup()
     7.7 -        moc = Record.Context.default
     7.8 +        moc = Stack.shared.mainContext
     7.9      }
    7.10      override func tearDown() {
    7.11          persistentSetup = nil
     8.1 --- a/pEpForiOSTests/ReplicationServiceTests.swift	Tue May 14 22:16:34 2019 +0200
     8.2 +++ b/pEpForiOSTests/ReplicationServiceTests.swift	Tue May 14 22:31:30 2019 +0200
     8.3 @@ -19,7 +19,7 @@
     8.4      override func setUp() {
     8.5          super.setUp()
     8.6          persistenceSetup = PersistentSetup()
     8.7 -        moc = Record.Context.default
     8.8 +        moc = Stack.shared.mainContext
     8.9      }
    8.10  
    8.11      override func tearDown() {
     9.1 --- a/pEpForiOSTests/SimpleOperationsTest.swift	Tue May 14 22:16:34 2019 +0200
     9.2 +++ b/pEpForiOSTests/SimpleOperationsTest.swift	Tue May 14 22:31:30 2019 +0200
     9.3 @@ -560,7 +560,7 @@
     9.4      }
     9.5  
     9.6      func testOutgoingMailColorPerformanceWithoutMySelf() {
     9.7 -        let moc = Stack.shared.newPrivateConcurrentContext
     9.8 +        let moc: NSManagedObjectContext = Stack.shared.mainContext
     9.9          let (myself, _, _, _, _) = TestUtil.setupSomeIdentities(session)
    9.10  
    9.11          guard let id = CdIdentity.from(pEpContact: myself, context: moc) else {
    10.1 --- a/pEpForiOSTests/TestUtils/CoreDataDrivenTestBase.swift	Tue May 14 22:16:34 2019 +0200
    10.2 +++ b/pEpForiOSTests/TestUtils/CoreDataDrivenTestBase.swift	Tue May 14 22:31:30 2019 +0200
    10.3 @@ -36,7 +36,7 @@
    10.4          XCTAssertTrue(PEPUtil.pEpClean())
    10.5          
    10.6          persistentSetup = PersistentSetup()
    10.7 -        moc = Stack.MessageModelObjectContext.default
    10.8 +        moc = Stack.shared.mainContext
    10.9  
   10.10          let cdAccount = SecretTestData().createWorkingCdAccount(context: moc)
   10.11          moc.saveAndLogErrors()
    11.1 --- a/pEpForiOSTests/TestUtils/TestUtil.swift	Tue May 14 22:16:34 2019 +0200
    11.2 +++ b/pEpForiOSTests/TestUtils/TestUtil.swift	Tue May 14 22:31:30 2019 +0200
    11.3 @@ -845,7 +845,7 @@
    11.4              return nil
    11.5          }
    11.6  
    11.7 -        let moc = Record.Context.default
    11.8 +        let moc: NSManagedObjectContext = Stack.shared.mainContext
    11.9          guard let cdMessage = CdMessage.insertOrUpdate(pantomimeMessage: pantomimeMail,
   11.10                                                         account: cdOwnAccount,
   11.11                                                         messageUpdate: CWMessageUpdate(),