diff --git a/Source/BlockCompletionApi.swift b/Source/BlockCompletionApi.swift index b186152412..5ef52011f3 100644 --- a/Source/BlockCompletionApi.swift +++ b/Source/BlockCompletionApi.swift @@ -23,7 +23,7 @@ public struct BlockCompletionApi { "username": username, "course_key": courseID, "blocks" : [ blockID: 1.0] - ])) + ] as [String : Any])) return NetworkRequest( method: .POST, diff --git a/Source/CalendarSyncConfig.swift b/Source/CalendarSyncConfig.swift index e675ab84da..46132fa4b3 100644 --- a/Source/CalendarSyncConfig.swift +++ b/Source/CalendarSyncConfig.swift @@ -41,7 +41,7 @@ struct CalendarSyncConfig { Keys.disabledVersions.rawValue: disabledVersions, Keys.selfPacedEnabled.rawValue: selfPacedEnabled, Keys.instructorPacedEnabled.rawValue: instructorPacedEnabled, - ] + ] as [String : Any] ] } } diff --git a/Source/Core/Code/NSObject+OEXDeallocAction.h b/Source/Core/Code/NSObject+OEXDeallocAction.h index 5dad6c56f7..64c50636bc 100644 --- a/Source/Core/Code/NSObject+OEXDeallocAction.h +++ b/Source/Core/Code/NSObject+OEXDeallocAction.h @@ -6,7 +6,7 @@ // Copyright (c) 2015-2016 edX. All rights reserved. // -@import Foundation; +#import NS_ASSUME_NONNULL_BEGIN diff --git a/Source/Core/Test/Code/NetworkManagerTests.swift b/Source/Core/Test/Code/NetworkManagerTests.swift index 257bb9646f..765c57a56c 100644 --- a/Source/Core/Test/Code/NetworkManagerTests.swift +++ b/Source/Core/Test/Code/NetworkManagerTests.swift @@ -67,7 +67,7 @@ class NetworkManagerTests: XCTestCase { let sampleJSON = JSON([ "Some field" : true, "Some other field" : ["a", "b"] - ]) + ] as [String : Any]) let apiRequest = NetworkRequest( method: HTTPMethod.POST, path: "/something", @@ -146,7 +146,7 @@ class NetworkManagerTests: XCTestCase { expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() XCTAssertEqual(manager.tokenStatus, AccessTokenStatus.expired) } @@ -172,7 +172,7 @@ class NetworkManagerTests: XCTestCase { manager.responseCache.setCacheResponse(response, withData: originalData, forRequest: urlRequest as URLRequest, completion: { cacheExpectation.fulfill() }) - waitForExpectations() + OEXWaitForExpectations() // make a request let networkData = "network".data(using: String.Encoding.utf8)! @@ -196,7 +196,7 @@ class NetworkManagerTests: XCTestCase { loadedExpectation.fulfill() } }) - waitForExpectations() + OEXWaitForExpectations() } XCTAssertEqual(results.value, [originalData, networkData]) @@ -218,7 +218,7 @@ class NetworkManagerTests: XCTestCase { stream.listen(owner) {_ in loadedExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } XCTAssertTrue(cache.isEmpty, "Requests with no response shouldn't enter cache") @@ -233,7 +233,7 @@ class NetworkManagerTests: XCTestCase { expectation.fulfill() } } - waitForExpectations() + OEXWaitForExpectations() XCTAssertFalse(stream.active) XCTAssertNotNil(stream.error) } @@ -256,7 +256,7 @@ class NetworkManagerTests: XCTestCase { stream.listenOnce(self) {_ in loadedExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let cacheExpectation = expectation(description: "Cache Load finished") manager.responseCache.fetchCacheEntryWithRequest(urlRequest) { @@ -265,7 +265,7 @@ class NetworkManagerTests: XCTestCase { XCTAssertEqual($0!.headers, headers) cacheExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func testAuthenticationActionAuthenticateSuccess() { @@ -309,7 +309,7 @@ class NetworkManagerTests: XCTestCase { XCTAssertEqual(response.data?.rawString(), "{\n \"I Love\" : \"Cake\"\n}") expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func testAuthenticationActionAuthenticateFailure() { @@ -340,7 +340,7 @@ class NetworkManagerTests: XCTestCase { XCTAssertEqual(response.data, nil) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func simpleStubResponseBuilder(_ statusCode: Int32, data: String) -> OHHTTPStubsResponse{ diff --git a/Source/Core/Test/Code/PaginationInfoTests.swift b/Source/Core/Test/Code/PaginationInfoTests.swift index 205f237d2a..460f0e3dda 100644 --- a/Source/Core/Test/Code/PaginationInfoTests.swift +++ b/Source/Core/Test/Code/PaginationInfoTests.swift @@ -18,7 +18,7 @@ class PaginationInfoTests: XCTestCase { "num_pages" : 3, "previous" : "http://example.com/previous", "next" : "http://example.com/next", - ]) + ] as [String : Any]) let info = PaginationInfo(json: json) XCTAssertEqual(info!.pageCount, 3) XCTAssertEqual(info!.totalCount, 25) @@ -31,7 +31,7 @@ class PaginationInfoTests: XCTestCase { "count" : 25, "previous" : "http://example.com/previous", "next" : "http://example.com/next", - ]) + ] as [String : Any]) let info = PaginationInfo(json: json) XCTAssertNil(info) } @@ -76,7 +76,7 @@ class PaginationInfoTests: XCTestCase { "num_pages" : 4 ], "results" : [1, 2, 3, 4] - ])) + ] as [String : Any])) XCTAssertEqual(parse.value!.value, [1, 2, 3, 4]) XCTAssertEqual(parse.value!.pagination.pageCount, 4) XCTAssertEqual(parse.value!.pagination.totalCount, 50) diff --git a/Source/Core/Test/Code/PersistentResponseCacheTests.swift b/Source/Core/Test/Code/PersistentResponseCacheTests.swift index 2c0c7f2f61..651ebc4c5e 100644 --- a/Source/Core/Test/Code/PersistentResponseCacheTests.swift +++ b/Source/Core/Test/Code/PersistentResponseCacheTests.swift @@ -63,7 +63,7 @@ class PersistentResponseCacheTests: XCTestCase { cache.setCacheResponse(response, withData: data, forRequest: request) { storeExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let loadExpectation = expectation(description: "Cache loaded") cache.fetchCacheEntryWithRequest(request) {entry in @@ -72,7 +72,7 @@ class PersistentResponseCacheTests: XCTestCase { XCTAssertEqual(entry!.statusCode, statusCode) XCTAssertEqual(entry!.headers, headers) } - waitForExpectations() + OEXWaitForExpectations() } func testDifferentMethods() { @@ -87,7 +87,7 @@ class PersistentResponseCacheTests: XCTestCase { cache.setCacheResponse(response, withData: getData, forRequest: getRequest) { getStoreExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let postStoreExpectation = expectation(description: "Cache stored POST") let postData = "test data".data(using: String.Encoding.utf8)! @@ -97,21 +97,21 @@ class PersistentResponseCacheTests: XCTestCase { cache.setCacheResponse(response, withData: postData, forRequest: postRequest as URLRequest) { postStoreExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let getLoadExpectation = expectation(description: "Cache loaded GET") cache.fetchCacheEntryWithRequest(getRequest) { XCTAssertEqual($0!.data!, getData) getLoadExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let postLoadExpectation = expectation(description: "Cache loaded POST") cache.fetchCacheEntryWithRequest(postRequest as URLRequest) { XCTAssertEqual($0!.data!, postData) postLoadExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func testMiss() { @@ -123,7 +123,7 @@ class PersistentResponseCacheTests: XCTestCase { cache.setCacheResponse(response, withData: nil, forRequest: request) { storeExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let loadExpectation = expectation(description: "Cache loaded") let otherRequest = URLRequest(url: URL(string : "http://edx.org")!) @@ -131,7 +131,7 @@ class PersistentResponseCacheTests: XCTestCase { XCTAssertNil($0) loadExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } @@ -177,7 +177,7 @@ class PersistentResponseCacheTests: XCTestCase { XCTAssertNil(entry) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } // Since we use NSCoding to save cache entries, it's not super robust against @@ -212,7 +212,7 @@ class PersistentResponseCacheTests: XCTestCase { XCTAssertEqual(entry?.data, "test".data(using: String.Encoding.utf8)) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } } diff --git a/Source/CourseCatalogAPI.swift b/Source/CourseCatalogAPI.swift index a278d3a7c7..0c72f4d252 100644 --- a/Source/CourseCatalogAPI.swift +++ b/Source/CourseCatalogAPI.swift @@ -66,7 +66,7 @@ public struct CourseCatalogAPI { "course_details" : [ "course_id": courseID, "email_opt_in": emailOptIn - ] + ] as [String : Any] ])), deserializer: .jsonResponse(enrollmentDeserializer) ) diff --git a/Source/CourseUpgradeAPI.swift b/Source/CourseUpgradeAPI.swift index 84c42d8cd0..b7e3602a65 100644 --- a/Source/CourseUpgradeAPI.swift +++ b/Source/CourseUpgradeAPI.swift @@ -44,7 +44,7 @@ public struct CourseUpgradeAPI { body: .jsonBody(JSON([ "basket_id": basketID, "payment_processor": PaymentProcessor - ])), + ] as [String : Any])), deserializer: .jsonResponse(checkoutDeserializer) ) } @@ -68,7 +68,7 @@ public struct CourseUpgradeAPI { "currency_code": currencyCode, "purchaseToken": receipt, "payment_processor": PaymentProcessor - ])), + ] as [String : Any])), deserializer: .jsonResponse(executeDeserializer) ) } diff --git a/Source/CourseUpgradeHelper.swift b/Source/CourseUpgradeHelper.swift index 7ffe8c0784..cd13abcb08 100644 --- a/Source/CourseUpgradeHelper.swift +++ b/Source/CourseUpgradeHelper.swift @@ -428,9 +428,9 @@ extension CourseUpgradeHelper { private func savedIAPSKUsFromKeychain() -> [String : [InappPurchase]] { guard let data = keychain.getData(IAPKeychainKey), - let purchases = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? [String : [InappPurchase]] + let purchases = try? NSKeyedUnarchiver.unarchivedObject(ofClasses: [InappPurchase.self, NSDictionary.self, NSString.self, NSArray.self], from: data) as? [String : [InappPurchase]] ?? [:] else { return [:] } - + return purchases } @@ -444,9 +444,13 @@ extension CourseUpgradeHelper { } } -class InappPurchase: NSObject, NSCoding { +class InappPurchase: NSObject, NSCoding, NSSecureCoding { var status: Bool = false var identifier: String = "" + + static var supportsSecureCoding: Bool { + return true + } required init?(coder: NSCoder) { identifier = coder.decodeObject(forKey: "identifier") as? String ?? "" diff --git a/Source/DiscussionAPI.swift b/Source/DiscussionAPI.swift index 0702295058..92518d5626 100644 --- a/Source/DiscussionAPI.swift +++ b/Source/DiscussionAPI.swift @@ -104,7 +104,7 @@ public class DiscussionAPI { "title" : newThread.title, "raw_body" : newThread.rawBody, "following" : follow - ]) + ] as [String : Any]) return NetworkRequest( method : HTTPMethod.POST, path : "/api/discussion/v1/threads/", diff --git a/Source/JSON+ReadFromFile.swift b/Source/JSON+ReadFromFile.swift index 4825965944..b88197bfcc 100644 --- a/Source/JSON+ReadFromFile.swift +++ b/Source/JSON+ReadFromFile.swift @@ -22,7 +22,7 @@ public extension JSON { let data = try? NSData(contentsOf: url, options: NSData.ReadingOptions.mappedIfSafe) else { assertionFailure("Couldn't load data from file") - self.init([:]) + self.init([:] as [String : Any]) return } self.init(data:data as Data) @@ -34,7 +34,7 @@ public extension JSON { let data = NSDictionary(contentsOf: url) else { assertionFailure("Couldn't load data from file") - self.init([:]) + self.init([:] as [String : Any]) return } self.init(data) diff --git a/Source/SegmentAnalyticsTracker.swift b/Source/SegmentAnalyticsTracker.swift index 69fdf09136..eb7453d7eb 100644 --- a/Source/SegmentAnalyticsTracker.swift +++ b/Source/SegmentAnalyticsTracker.swift @@ -67,7 +67,7 @@ class SegmentAnalyticsTracker : NSObject, OEXAnalyticsTracker { } func trackScreen(withName screenName: String, courseID: String?, value: String?, additionalInfo info: [String : String]?) { - var properties: [String:Any] = [ + var properties: [String : Any] = [ key_context: [ key_app_name: value_app_name ] diff --git a/Test/APIURLDefaultVersionTests.swift b/Test/APIURLDefaultVersionTests.swift index 2d0ec3c43a..4fb21a1b9d 100644 --- a/Test/APIURLDefaultVersionTests.swift +++ b/Test/APIURLDefaultVersionTests.swift @@ -17,7 +17,7 @@ class APIURLDefaultVersionTests: XCTestCase { } func testEmptyAPIURLConfig() { - let config = OEXConfig(dictionary:["API_URL_VERSION":[:]]) + let config = OEXConfig(dictionary:["API_URL_VERSION":[:] as [String : Any]]) XCTAssertEqual(config.apiUrlVersionConfig.blocks, APIURLDefaultVersion.blocks.rawValue) } diff --git a/Test/CourseCatalogDetailViewControllerTests.swift b/Test/CourseCatalogDetailViewControllerTests.swift index 7d65a38ede..75a720bc08 100644 --- a/Test/CourseCatalogDetailViewControllerTests.swift +++ b/Test/CourseCatalogDetailViewControllerTests.swift @@ -126,7 +126,7 @@ class CourseCatalogDetailViewControllerTests: SnapshotTestCase { XCTAssertTrue(controller.t_isShowingOverlayMessage) expectations.fulfill() }) - waitForExpectations() + OEXWaitForExpectations() } } @@ -147,7 +147,7 @@ class CourseCatalogDetailViewControllerTests: SnapshotTestCase { XCTAssertTrue(controller.t_isShowingAlertView()) expectations.fulfill() }) - waitForExpectations() + OEXWaitForExpectations() } } @@ -173,7 +173,7 @@ class CourseCatalogDetailViewControllerTests: SnapshotTestCase { controller.t_enrollInCourse { completionCalled = true } - waitForExpectations() + OEXWaitForExpectations() XCTAssertTrue(completionCalled) } return environment diff --git a/Test/CourseContentPageViewControllerTests.swift b/Test/CourseContentPageViewControllerTests.swift index 97e40f5045..d8368a5dac 100644 --- a/Test/CourseContentPageViewControllerTests.swift +++ b/Test/CourseContentPageViewControllerTests.swift @@ -48,7 +48,7 @@ class CourseContentPageViewControllerTests: SnapshotTestCase { } } } - self.waitForExpectations() + self.OEXWaitForExpectations() } return controller } diff --git a/Test/CourseDashboardViewControllerTests.swift b/Test/CourseDashboardViewControllerTests.swift index 098b4b9570..508d7cb618 100644 --- a/Test/CourseDashboardViewControllerTests.swift +++ b/Test/CourseDashboardViewControllerTests.swift @@ -112,7 +112,7 @@ class CourseDashboardViewControllerTests: SnapshotTestCase { expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() inScreenNavigationContext(controller, action: { () -> () in assertSnapshotValidWithContent(controller.navigationController!) @@ -146,7 +146,7 @@ class CourseDashboardViewControllerTests: SnapshotTestCase { expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() inScreenNavigationContext(controller, action: { () -> () in diff --git a/Test/CourseDataManagerTests.swift b/Test/CourseDataManagerTests.swift index 2d5cc84ac5..bd0dfa6681 100644 --- a/Test/CourseDataManagerTests.swift +++ b/Test/CourseDataManagerTests.swift @@ -21,7 +21,7 @@ class CourseDataManagerTests: XCTestCase { XCTAssertEqual(rootBlock.value!.blockID, rootID, file : file, line : line) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func addInterceptorForOutline(_ networkManager: MockNetworkManager, outline : CourseOutline) { diff --git a/Test/CourseOutlineQuerierTests.swift b/Test/CourseOutlineQuerierTests.swift index e6daa8eac6..06f7660d23 100644 --- a/Test/CourseOutlineQuerierTests.swift +++ b/Test/CourseOutlineQuerierTests.swift @@ -30,7 +30,7 @@ class CourseOutlineQuerierTests: XCTestCase { XCTAssertEqual(block.value!.blockID, blockID) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() removable.remove() } @@ -49,7 +49,7 @@ class CourseOutlineQuerierTests: XCTestCase { XCTAssertEqual(Set(blocks.value!), Set(knownNodes)) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() removable.remove() } @@ -99,7 +99,7 @@ class CourseOutlineQuerierTests: XCTestCase { expectation.fulfill() } } - waitForExpectations() + OEXWaitForExpectations() removable.remove() // now if we supply a loadable outline @@ -118,7 +118,7 @@ class CourseOutlineQuerierTests: XCTestCase { expectation.fulfill() } } - waitForExpectations() + OEXWaitForExpectations() removable.remove() } diff --git a/Test/CourseOutlineTestDataFactory.swift b/Test/CourseOutlineTestDataFactory.swift index 6af2a0e35b..2080d27e9e 100644 --- a/Test/CourseOutlineTestDataFactory.swift +++ b/Test/CourseOutlineTestDataFactory.swift @@ -38,7 +38,7 @@ open class CourseOutlineTestDataFactory { "block1": CourseBlock(type: CourseBlockType.HTML, children : [], blockID : "block1", minifiedBlockID: "123456", name : "Block 1", multiDevice : true), "block2": CourseBlock(type: CourseBlockType.HTML, children : [], blockID : "block2", minifiedBlockID: "123456", name : "Block 2", multiDevice : true), "block3": CourseBlock(type: CourseBlockType.Problem, children : [], blockID : "block3", minifiedBlockID: "123456", name : "Block 3", multiDevice : true, authorizationDenialReason: "Feature-based Enrollments", authorizationDenialMessage: "Gradded Assessments"), - "block4": CourseBlock(type: CourseBlockType.Video(OEXVideoSummaryTestDataFactory.localVideoWithID("block4", pathIDs: ["chapter1", "section1.1", "unit2"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"]] )), children : [], blockID : "block4", minifiedBlockID: "123456", name : "Block 4", blockCounts : ["video" : 1], multiDevice : true), + "block4": CourseBlock(type: CourseBlockType.Video(OEXVideoSummaryTestDataFactory.localVideoWithID("block4", pathIDs: ["chapter1", "section1.1", "unit2"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]] )), children : [], blockID : "block4", minifiedBlockID: "123456", name : "Block 4", blockCounts : ["video" : 1], multiDevice : true), "block5": CourseBlock(type: CourseBlockType.Unknown("something"), children : [], blockID : "block5", minifiedBlockID: "123456", name : "Block 5", multiDevice : false) ]) } diff --git a/Test/CourseOutlineViewControllerTests.swift b/Test/CourseOutlineViewControllerTests.swift index aa9cac3750..d5783d2d85 100644 --- a/Test/CourseOutlineViewControllerTests.swift +++ b/Test/CourseOutlineViewControllerTests.swift @@ -53,7 +53,7 @@ class CourseOutlineViewControllerTests: SnapshotTestCase { } } } - self.waitForExpectations() + self.OEXWaitForExpectations() } } @@ -70,7 +70,7 @@ class CourseOutlineViewControllerTests: SnapshotTestCase { XCTAssertGreaterThan(full.children.count, filtered.children.count) expectation.fulfill() } - self.waitForExpectations() + self.OEXWaitForExpectations() } func testScreenAnalyticsRoot() { diff --git a/Test/CourseSectionTableViewCellTests.swift b/Test/CourseSectionTableViewCellTests.swift index 795d8fdcbd..9e79adb313 100644 --- a/Test/CourseSectionTableViewCellTests.swift +++ b/Test/CourseSectionTableViewCellTests.swift @@ -52,7 +52,7 @@ class CourseSectionTableViewCellTests: SnapshotTestCase { } } } - waitForExpectations() + OEXWaitForExpectations() } } diff --git a/Test/DiscoveryConfigTests.swift b/Test/DiscoveryConfigTests.swift index cae7ae2e20..e2045a665d 100644 --- a/Test/DiscoveryConfigTests.swift +++ b/Test/DiscoveryConfigTests.swift @@ -18,7 +18,7 @@ class DiscoveryConfigTests: XCTestCase { } func testDiscoveryEmptyConfig() { - let config = OEXConfig(dictionary:["DISCOVERY":[:]]) + let config = OEXConfig(dictionary:["DISCOVERY":[:] as [String : Any]]) XCTAssertFalse(config.discovery.isEnabled) XCTAssertEqual(config.discovery.type, .none) } @@ -46,9 +46,8 @@ class DiscoveryConfigTests: XCTestCase { "BASE_URL": sampleBaseURL, "COURSE_DETAIL_TEMPLATE": sampleInfoURLTemplate, "PROGRAM_DETAIL_TEMPLATE": sampleProgramInfoURLTemplate - - ] - ] + ] as [String : Any] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) diff --git a/Test/DiscoveryHelperTests.swift b/Test/DiscoveryHelperTests.swift index c6723c3fe0..e960ffdb41 100644 --- a/Test/DiscoveryHelperTests.swift +++ b/Test/DiscoveryHelperTests.swift @@ -27,7 +27,7 @@ private extension OEXConfig { "PROGRAM_URL": programURL, "PROGRAM_DETAIL_URL_TEMPLATE": programDetailURLTemplate, "ENABLED": enabled - ] + ] as [String : Any] ] ) } diff --git a/Test/DiscussionNewPostViewControllerTests.swift b/Test/DiscussionNewPostViewControllerTests.swift index aa53afd41f..71914e7297 100644 --- a/Test/DiscussionNewPostViewControllerTests.swift +++ b/Test/DiscussionNewPostViewControllerTests.swift @@ -25,7 +25,7 @@ class DiscussionNewPostViewControllerTests: SnapshotTestCase { controller.t_topicsLoaded().listenOnce(self) {_ in expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() inScreenNavigationContext(controller, action: { assertSnapshotValidWithContent(controller.navigationController!) diff --git a/Test/DiscussionTopicsViewControllerTests.swift b/Test/DiscussionTopicsViewControllerTests.swift index 1be09f8f1f..15f44e952e 100644 --- a/Test/DiscussionTopicsViewControllerTests.swift +++ b/Test/DiscussionTopicsViewControllerTests.swift @@ -23,7 +23,7 @@ class DiscussionTopicsViewControllerTests: SnapshotTestCase { controller.t_topicsLoaded().listenOnce(self) {_ in expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() inScreenNavigationContext(controller){ assertSnapshotValidWithContent(controller.navigationController!) diff --git a/Test/EndToEnd/Code/FeatureTestCase.swift b/Test/EndToEnd/Code/FeatureTestCase.swift index 42cad2bab2..56dd76e483 100644 --- a/Test/EndToEnd/Code/FeatureTestCase.swift +++ b/Test/EndToEnd/Code/FeatureTestCase.swift @@ -33,7 +33,7 @@ extension FeatureInteractor { func waitForElement(_ element: XCUIElement, predicate: NSPredicate = NSPredicate(format: "exists == true"), file: String = #file, line: UInt = #line) { FeatureTestCase.activeTest.expectation(for: predicate, evaluatedWith: element, handler: nil) - FeatureTestCase.activeTest.waitForExpectations { (error) -> Void in + FeatureTestCase.activeTest.OEXWaitForExpectations { (error) -> Void in if error != nil { FeatureTestCase.activeTest.record(XCTIssue(type: .assertionFailure, compactDescription: "Timeout waiting for element: \(element)", sourceCodeContext: XCTSourceCodeContext(location: XCTSourceCodeLocation(filePath: file, lineNumber: Int(line))))) } diff --git a/Test/EnrolledCoursesViewControllerTests.swift b/Test/EnrolledCoursesViewControllerTests.swift index a51e3f0465..4e353256b1 100644 --- a/Test/EnrolledCoursesViewControllerTests.swift +++ b/Test/EnrolledCoursesViewControllerTests.swift @@ -105,7 +105,7 @@ class EnrolledCoursesViewControllerTests: SnapshotTestCase { let versionInfoController = VersionUpgradeInfoController.sharedController versionInfoController.populateFromHeaders(httpResponseHeaders: VersionUpgradeDataFactory.versionUpgradeInfo as? [String : Any]) - self.waitForExpectations() + self.OEXWaitForExpectations() removable.remove() XCTAssertTrue(controller.t_isShowingSnackBar) // remove version upgrade info diff --git a/Test/EnrolledTabBarViewControllerTest.swift b/Test/EnrolledTabBarViewControllerTest.swift index 60aa9031fe..83a69cff9d 100644 --- a/Test/EnrolledTabBarViewControllerTest.swift +++ b/Test/EnrolledTabBarViewControllerTest.swift @@ -14,7 +14,7 @@ class EnrolledTabBarViewControllerTest: SnapshotTestCase { func testsnapshotEnrolledTabBarView() { let configDict = [ - "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]], + "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]] as [String : Any], "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] ] let config = OEXConfig(dictionary: configDict) @@ -36,9 +36,9 @@ class EnrolledTabBarViewControllerTest: SnapshotTestCase { func testsnapshotEnrolledTabBarViewDiscovery() { let configDict = [ - "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]], - "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] - ] + "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]] as [String : Any], + "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] as [String : Any] + ] as [String : Any] let config = OEXConfig(dictionary: configDict) let courses = [OEXCourse.freshCourse(), OEXCourse.freshCourse()] let environment = TestRouterEnvironment(config: config, interface: nil).logInTestUser() @@ -58,7 +58,7 @@ class EnrolledTabBarViewControllerTest: SnapshotTestCase { func testsnapshotEnrolledTabBarViewProgramDisable() { let configDict = [ - "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]] + "DISCOVERY": ["TYPE": "webview", "WEBVIEW":["BASE_URL": "https:www.testurl.com"]] as [String : Any] ] let config = OEXConfig(dictionary: configDict) let courses = [OEXCourse.freshCourse(), OEXCourse.freshCourse()] @@ -96,7 +96,7 @@ class EnrolledTabBarViewControllerTest: SnapshotTestCase { func testsnapshotEnrolledTabBarViewDiscoveryDisable() { let configDict = [ - "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] + "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] as [String : Any] ] let config = OEXConfig(dictionary: configDict) let courses = [OEXCourse.freshCourse(), OEXCourse.freshCourse()] @@ -116,7 +116,7 @@ class EnrolledTabBarViewControllerTest: SnapshotTestCase { func testsnapshotEnrolledTabBarProgramsView() { let configDict = [ - "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] + "PROGRAM": ["ENABLED": true, "PROGRAM_URL": "https:www.testurl.com"] as [String : Any] ] let config = OEXConfig(dictionary: configDict) let courses = [OEXCourse.freshCourse(), OEXCourse.freshCourse()] diff --git a/Test/FirebaseConfigTests.swift b/Test/FirebaseConfigTests.swift index 502d04a164..e7f4dbd35a 100644 --- a/Test/FirebaseConfigTests.swift +++ b/Test/FirebaseConfigTests.swift @@ -27,7 +27,7 @@ class FirebaseConfigTests: XCTestCase { } func testEmptyFirebaseConfig() { - let config = OEXConfig(dictionary:["FIREBASE":[:]]) + let config = OEXConfig(dictionary:["FIREBASE":[:] as [String : Any]]) XCTAssertFalse(config.firebaseConfig.enabled) XCTAssertFalse(config.firebaseConfig.cloudMessagingEnabled) XCTAssertFalse(config.firebaseConfig.isAnalyticsSourceFirebase) @@ -46,7 +46,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -66,7 +66,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -83,7 +83,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -101,7 +101,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -119,7 +119,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -138,7 +138,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -157,7 +157,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -176,7 +176,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -195,7 +195,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -226,7 +226,7 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) @@ -244,12 +244,12 @@ class FirebaseConfigTests: XCTestCase { "CLIENT_ID" : clientID, "GOOGLE_APP_ID" : googleAppID, "GCM_SENDER_ID" : gcmSenderID - ], + ] as [String : Any], "SEGMENT_IO": [ "ENABLED": true, "SEGMENT_IO_WRITE_KEY": "p910192UHD101010nY0000001Kb00GFcz'" - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) diff --git a/Test/MicrosoftConfigTests.swift b/Test/MicrosoftConfigTests.swift index 5ca3c241fe..a4ae99d091 100644 --- a/Test/MicrosoftConfigTests.swift +++ b/Test/MicrosoftConfigTests.swift @@ -21,7 +21,7 @@ class MicrosoftConfigTests: XCTestCase { } func testEmptyMicrosoftConfig() { - let config = OEXConfig(dictionary:["MICROSOFT":[:]]) + let config = OEXConfig(dictionary:["MICROSOFT":[:] as [String : Any]]) XCTAssertFalse(config.microsoftConfig.enabled) XCTAssertNil(config.microsoftConfig.appID) } @@ -31,7 +31,7 @@ class MicrosoftConfigTests: XCTestCase { "MICROSOFT" : [ "ENABLED": true, "APP_ID" : microsoftAppID - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) diff --git a/Test/MockNetworkManager.swift b/Test/MockNetworkManager.swift index 0b042c7794..fab5f9c08c 100644 --- a/Test/MockNetworkManager.swift +++ b/Test/MockNetworkManager.swift @@ -123,7 +123,7 @@ class MockNetworkManagerTests : XCTestCase { XCTAssertEqual(result.data!, "Success") expectation.fulfill() } - self.waitForExpectations() + self.OEXWaitForExpectations() } func testNoInterceptorsFails() { @@ -139,7 +139,7 @@ class MockNetworkManagerTests : XCTestCase { XCTAssertNotNil(result.error) expectation.fulfill() } - self.waitForExpectations() + self.OEXWaitForExpectations() } } diff --git a/Test/NSAttributedString+OEXFormattingTests.m b/Test/NSAttributedString+OEXFormattingTests.m index d27aef95e8..1d69dfd4b6 100644 --- a/Test/NSAttributedString+OEXFormattingTests.m +++ b/Test/NSAttributedString+OEXFormattingTests.m @@ -18,7 +18,7 @@ @interface NSAttributedString_OEXFormatting : XCTestCase @implementation NSAttributedString_OEXFormatting - (void)testFormatNoParams { - NSAttributedString* format = [[NSAttributedString alloc] initWithString:@"some string with { stuff in it" attributes:nil]; + NSAttributedString* format = [[NSAttributedString alloc] initWithString: NSLocalizedString(@"some string with { stuff in it", nil) attributes:nil]; NSAttributedString* result = [format oex_formatWithParameters:@{}]; XCTAssertEqualObjects(result.string, format.string); } @@ -27,8 +27,8 @@ - (void)testFormatReplacement { CGFloat baseSize = 14; CGFloat otherSize = 18; - NSAttributedString* format = [[NSAttributedString alloc] initWithString:@"{param} string with {param} stuff in it" attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:baseSize] }]; - NSAttributedString* replacement = [[NSAttributedString alloc] initWithString:@"some" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:otherSize]}]; + NSAttributedString* format = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"{param} string with {param} stuff in it", nil) attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:baseSize] }]; + NSAttributedString* replacement = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"some", nil) attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:otherSize]}]; NSAttributedString* result = [format oex_formatWithParameters:@{@"param" : replacement}]; XCTAssertEqualObjects(result.string, @"some string with some stuff in it"); diff --git a/Test/NSObject+SafeKVOTests.swift b/Test/NSObject+SafeKVOTests.swift index 653bbb8a1d..602059e05e 100644 --- a/Test/NSObject+SafeKVOTests.swift +++ b/Test/NSObject+SafeKVOTests.swift @@ -20,7 +20,7 @@ class KVOListenerTests: XCTestCase { expectation.fulfill() } observed.value = "new" - waitForExpectations() + OEXWaitForExpectations() remover.remove() } diff --git a/Test/NetworkManager+AuthenticatorTests.swift b/Test/NetworkManager+AuthenticatorTests.swift index 79c1ea570b..20b27118c6 100644 --- a/Test/NetworkManager+AuthenticatorTests.swift +++ b/Test/NetworkManager+AuthenticatorTests.swift @@ -26,7 +26,7 @@ class NetworkManager_AuthenticationTests : XCTestCase { } } - waitForExpectations() + OEXWaitForExpectations() removeable.remove() } diff --git a/Test/NetworkManager+InterceptionTests.swift b/Test/NetworkManager+InterceptionTests.swift index 988b9a28b9..632edc2c28 100644 --- a/Test/NetworkManager+InterceptionTests.swift +++ b/Test/NetworkManager+InterceptionTests.swift @@ -41,7 +41,7 @@ class NetworkManager_InterceptionTests : XCTestCase { expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() OHHTTPStubs.removeStub(stub) } @@ -70,7 +70,7 @@ class NetworkManager_InterceptionTests : XCTestCase { XCTAssertNil(result.data) expectations.fulfill() } - self.waitForExpectations() + self.OEXWaitForExpectations() } diff --git a/Test/OEXCourse+TestData.swift b/Test/OEXCourse+TestData.swift index 2ab9440a23..5aa674a0f8 100644 --- a/Test/OEXCourse+TestData.swift +++ b/Test/OEXCourse+TestData.swift @@ -45,7 +45,7 @@ public extension OEXCourse { courseDictionary["course_handouts"] = "http://www.url.com" } - var unparsedMediaInfos : [String:Any] = [:] + var unparsedMediaInfos : [String : Any] = [:] for (name, info) in mediaInfo { unparsedMediaInfos[name] = info.dictionary } diff --git a/Test/OEXVideoSummaryTestDataFactory.swift b/Test/OEXVideoSummaryTestDataFactory.swift index 9260fada57..026654b540 100644 --- a/Test/OEXVideoSummaryTestDataFactory.swift +++ b/Test/OEXVideoSummaryTestDataFactory.swift @@ -48,7 +48,7 @@ class OEXVideoSummaryTestDataFactory { "duration" : 100, "encoded_videos": encodings ?? [:], "transcripts": ["en": TranscriptDataFactory.validTranscriptString] - ] + ] as [String : Any] ] return OEXVideoSummary(dictionary: info) } @@ -56,12 +56,12 @@ class OEXVideoSummaryTestDataFactory { // This method create the mock video objects static func localCourseVideos(_ videoID : String) -> [OEXHelperVideoDownload]{ - let video1 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"]]) - let video2 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"]]) - let video3 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot2", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"]]) - let video4 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section2dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"]]) + let video1 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]]) + let video2 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]]) + let video3 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section1dot2", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]]) + let video4 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section2dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]]) - let video5 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section2dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"], "mobile_high":["file_size":3700000, "url":"https://www.example.com/video.mp4"]]) + let video5 = OEXVideoSummaryTestDataFactory.localVideoWithID(videoID, pathIDs: ["chapterid1", "section2dot1", "section1dot1"], encodings:["mobile_low":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any], "mobile_high":["file_size":3700000, "url":"https://www.example.com/video.mp4"] as [String : Any]] as [String : Any]) return OEXVideoSummaryTestDataFactory.videos(with: [video1, video2, video3, video4, video5]) } diff --git a/Test/OfflineSupportViewControllerTests.swift b/Test/OfflineSupportViewControllerTests.swift index 3fd7f0fb30..75f611ca0f 100644 --- a/Test/OfflineSupportViewControllerTests.swift +++ b/Test/OfflineSupportViewControllerTests.swift @@ -29,7 +29,7 @@ class OfflineSupportViewControllerTests: XCTestCase { } reachability.networkStatus = (wifi : false, wwan : false) - self.waitForExpectations() + self.OEXWaitForExpectations() removable.remove() XCTAssertTrue(controller.t_isShowingSnackBar) } diff --git a/Test/ProgramConfigTests.swift b/Test/ProgramConfigTests.swift index bade1044ae..6ade5aa17a 100644 --- a/Test/ProgramConfigTests.swift +++ b/Test/ProgramConfigTests.swift @@ -19,7 +19,7 @@ class ProgramConfigTests: XCTestCase { } func testEmptyProgramConfig() { - let config = OEXConfig(dictionary:["PROGRAM":[:]]) + let config = OEXConfig(dictionary:["PROGRAM":[:] as[String : Any]]) XCTAssertNil(config.programConfig.programURL) XCTAssertNil(config.programConfig.programDetailURLTemplate) XCTAssertFalse(config.programConfig.enabled) @@ -33,7 +33,7 @@ class ProgramConfigTests: XCTestCase { "PROGRAM_URL": programUrl, "PROGRAM_DETAIL_URL_TEMPLATE": programDetailUrlTemplate, "ENABLED": true - ] + ] as [String : Any] ] let config = OEXConfig(dictionary: configDictionary) diff --git a/Test/RegistrationViewControllerTests.swift b/Test/RegistrationViewControllerTests.swift index 627dedc8e5..71e79ccee5 100644 --- a/Test/RegistrationViewControllerTests.swift +++ b/Test/RegistrationViewControllerTests.swift @@ -59,7 +59,7 @@ class RegistrationViewControllerTests: SnapshotTestCase { } func testSnapshotContent() { - let config = OEXConfig(dictionary:["FACEBOOK": [ "ENABLED": true ], "GOOGLE": ["ENABLED": true, "GOOGLE_PLUS_KEY": "FAKE"],"MICROSOFT": ["ENABLED": true, "GOOGLE_PLUS_KEY": "FAKE"], "PLATFORM_NAME" : "App Test"]) + let config = OEXConfig(dictionary:["FACEBOOK": [ "ENABLED": true ], "GOOGLE": ["ENABLED": true, "GOOGLE_PLUS_KEY": "FAKE"] as [String : Any],"MICROSOFT": ["ENABLED": true, "GOOGLE_PLUS_KEY": "FAKE"] as [String : Any], "PLATFORM_NAME" : "App Test"] as [String : Any]) let environment = TestRouterEnvironment(config: config, interface: nil) let json = JSON(resourceNamed: "RegistrationForm") environment.mockNetworkManager.interceptWhenMatching({(_: NetworkRequest) in true }) { diff --git a/Test/RemoteImageTests.swift b/Test/RemoteImageTests.swift index 8129cd0388..45c8dc6b0f 100644 --- a/Test/RemoteImageTests.swift +++ b/Test/RemoteImageTests.swift @@ -33,7 +33,7 @@ class RemoteImageTests: XCTestCase { box.value = response expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() OHHTTPStubs.removeStub(stub) return box.value! diff --git a/Test/SessionUsernameProviderTests.swift b/Test/SessionUsernameProviderTests.swift index a21b75de2a..92e71e4b54 100644 --- a/Test/SessionUsernameProviderTests.swift +++ b/Test/SessionUsernameProviderTests.swift @@ -56,7 +56,7 @@ class SessionUsernameProviderTests: XCTestCase { XCTAssertEqual(entry?.data, responseData) expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } } diff --git a/Test/StartupViewControllerTests.swift b/Test/StartupViewControllerTests.swift index d4944fc9f3..90cd74e033 100644 --- a/Test/StartupViewControllerTests.swift +++ b/Test/StartupViewControllerTests.swift @@ -19,7 +19,7 @@ class StartupViewControllerTests: SnapshotTestCase { "WEBVIEW": [ "BASE_URL": "www.example.com", ] - ], + ] as [String : Any], "PROGRAM": [ "TYPE": "webview", "WEBVIEW": [ diff --git a/Test/TranscriptParserTests.swift b/Test/TranscriptParserTests.swift index 4f4285882e..7f12e24256 100644 --- a/Test/TranscriptParserTests.swift +++ b/Test/TranscriptParserTests.swift @@ -25,7 +25,7 @@ class TranscriptParserTests: XCTestCase { } } - waitForExpectations { (error) in + OEXWaitForExpectations { (error) in if error != nil { XCTFail("Transcript parsing failed") } @@ -44,7 +44,7 @@ class TranscriptParserTests: XCTestCase { } } - waitForExpectations { (error) in + OEXWaitForExpectations { (error) in if error != nil { XCTFail("Transcript parsing failed") } @@ -62,7 +62,7 @@ class TranscriptParserTests: XCTestCase { } } - waitForExpectations { (error) in + OEXWaitForExpectations { (error) in if error != nil { XCTFail("Transcript parsing failed") } @@ -81,7 +81,7 @@ class TranscriptParserTests: XCTestCase { } } - waitForExpectations { (error) in + OEXWaitForExpectations { (error) in if error != nil { XCTFail("Transcript parsing failed") } @@ -102,7 +102,7 @@ class TranscriptParserTests: XCTestCase { } } - waitForExpectations { (error) in + OEXWaitForExpectations { (error) in if error != nil { XCTFail("Transcript parsing failed") } diff --git a/Test/UserProfileManagerTests.swift b/Test/UserProfileManagerTests.swift index a8665e1aca..6e9f02cdf2 100644 --- a/Test/UserProfileManagerTests.swift +++ b/Test/UserProfileManagerTests.swift @@ -41,7 +41,7 @@ class UserProfileManagerTests : XCTestCase { testExpectation.fulfill() } } - waitForExpectations() + OEXWaitForExpectations() removable.remove() session.closeAndClear() @@ -66,7 +66,7 @@ class UserProfileManagerTests : XCTestCase { testExpectation.fulfill() } } - waitForExpectations() + OEXWaitForExpectations() removable.remove() } @@ -80,7 +80,7 @@ class UserProfileManagerTests : XCTestCase { profile = $0.value testExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() let newBio = "Test Passed" profile.updateDictionary = ["bio" : newBio as AnyObject] @@ -95,7 +95,7 @@ class UserProfileManagerTests : XCTestCase { XCTAssertEqual(result.value!.bio, newBio) testExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() // We updated the profile so the current user feed should also fire testExpectation = expectation(description: "Profile feed update") @@ -103,7 +103,7 @@ class UserProfileManagerTests : XCTestCase { XCTAssertEqual($0.value!.bio!, newBio) testExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } func testClearsOnLogOut() { @@ -116,7 +116,7 @@ class UserProfileManagerTests : XCTestCase { testExpectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() XCTAssertNotNil(feed.output.value!.username) session.closeAndClear() diff --git a/Test/VideoPlayerTests.swift b/Test/VideoPlayerTests.swift index 20e908ad2e..74b54a817d 100644 --- a/Test/VideoPlayerTests.swift +++ b/Test/VideoPlayerTests.swift @@ -41,7 +41,7 @@ class VideoPlayerTests: XCTestCase { } expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() removable.remove() stopPlayer() } diff --git a/Test/XCTestCase+Async.swift b/Test/XCTestCase+Async.swift index d951ad4a52..6109b6a68f 100644 --- a/Test/XCTestCase+Async.swift +++ b/Test/XCTestCase+Async.swift @@ -13,7 +13,7 @@ extension XCTestCase { // Standardize on a reasonable timeout to account for slow CI systems interacting with slow operations like // screenshot generation. Also makes it easier to change to a long number when debugging - func waitForExpectations(_ handler : XCWaitCompletionHandler? = nil) { + func OEXWaitForExpectations(_ handler : XCWaitCompletionHandler? = nil) { self.waitForExpectations(timeout: 60, handler: handler) } @@ -22,6 +22,6 @@ extension XCTestCase { DispatchQueue.main.async { expectation.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } } diff --git a/Test/XCTestCase+Stream.swift b/Test/XCTestCase+Stream.swift index c22bee8382..39805c6af4 100644 --- a/Test/XCTestCase+Stream.swift +++ b/Test/XCTestCase+Stream.swift @@ -16,6 +16,6 @@ extension XCTestCase { verifier?($0) expectations.fulfill() } - waitForExpectations() + OEXWaitForExpectations() } } diff --git a/Test/YoutubeVideoConfigTest.swift b/Test/YoutubeVideoConfigTest.swift index a07d8c409b..ce958a4a40 100644 --- a/Test/YoutubeVideoConfigTest.swift +++ b/Test/YoutubeVideoConfigTest.swift @@ -18,7 +18,7 @@ class YoutubeVideoConfigTests: XCTestCase { } func testEmptyYoutubeVideoConfig() { - let config = OEXConfig(dictionary:["YOUTUBE_PLAYER":[:]]) + let config = OEXConfig(dictionary:["YOUTUBE_PLAYER":[:] as [String : Any]]) XCTAssertFalse(config.youtubeVideoConfig.enabled) } diff --git a/edX.xcodeproj/project.pbxproj b/edX.xcodeproj/project.pbxproj index 53760887b9..8c39838b7c 100644 --- a/edX.xcodeproj/project.pbxproj +++ b/edX.xcodeproj/project.pbxproj @@ -4365,9 +4365,10 @@ BECB7B031924C0C3009C77F1 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1230; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = edX; TargetAttributes = { 77E6478D1C90C10300B6740D = { @@ -4388,7 +4389,6 @@ TestTargetID = BECB7B0A1924C0C3009C77F1; }; BECB7B0A1924C0C3009C77F1 = { - DevelopmentTeam = 57UCUYGPA2; LastSwiftMigration = 1030; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -4715,7 +4715,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# copy config from app bundle to test bundle\n\nSOURCE=$BUILT_PRODUCTS_DIR/$TEST_TARGET_NAME.app/config.plist\nDEST=$TARGET_BUILD_DIR/$WRAPPER_NAME/config.plist\ncp $SOURCE $DEST"; + shellScript = "# copy config from app bundle to test bundle\n\nSOURCE=$BUILT_PRODUCTS_DIR/$TEST_TARGET_NAME.app/config.plist\nDEST=$TARGET_BUILD_DIR/$WRAPPER_NAME/config.plist\ncp $SOURCE $DEST\n"; }; 77BDD65E1A44BD7300EA2A9C /* Process Config */ = { isa = PBXShellScriptBuildPhase; @@ -5832,6 +5832,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = YES; DEFINES_MODULE = YES; + ENABLE_MODULE_VERIFIER = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -5846,6 +5847,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_NAME = edX; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -5859,14 +5862,16 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)\n"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; CLANG_ENABLE_MODULES = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGN_ENTITLEMENTS = edX.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CONFIGURATION_BUILD_DIR = "$PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; CURRENT_PROJECT_VERSION = 4; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 57UCUYGPA2; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = "$(inherited)"; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited)"; @@ -6023,6 +6028,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Source/Core/SupportingFiles/Info.plist; @@ -6033,6 +6039,8 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = org.edx.edXCore; PRODUCT_NAME = edXCore; @@ -6061,6 +6069,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Source/Core/SupportingFiles/Info.plist; @@ -6071,6 +6080,8 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = org.edx.edXCore; PRODUCT_NAME = edXCore; @@ -6098,6 +6109,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Source/Core/SupportingFiles/Info.plist; @@ -6108,6 +6120,8 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = org.edx.edXCore; PRODUCT_NAME = edXCore; @@ -6326,6 +6340,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; + ENABLE_MODULE_VERIFIER = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -6346,6 +6361,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = edX; RUN_CLANG_STATIC_ANALYZER = YES; @@ -6385,6 +6402,7 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; COPY_PHASE_STRIP = YES; DEFINES_MODULE = YES; + ENABLE_MODULE_VERIFIER = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -6399,6 +6417,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; PRODUCT_NAME = edX; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -6414,14 +6434,16 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)\n"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; CLANG_ENABLE_MODULES = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGN_ENTITLEMENTS = edX.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CONFIGURATION_BUILD_DIR = "$PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; CURRENT_PROJECT_VERSION = 4; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 57UCUYGPA2; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = "$(inherited)"; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited)"; @@ -6506,14 +6528,16 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)\n"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; CLANG_ENABLE_MODULES = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGN_ENTITLEMENTS = edX.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CONFIGURATION_BUILD_DIR = "$PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; CURRENT_PROJECT_VERSION = 4; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 57UCUYGPA2; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = "$(inherited)"; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited)"; diff --git a/edX.xcodeproj/xcshareddata/xcschemes/EndToEndTests.xcscheme b/edX.xcodeproj/xcshareddata/xcschemes/EndToEndTests.xcscheme index 0d5d87a536..dbf98ff3b1 100644 --- a/edX.xcodeproj/xcshareddata/xcschemes/EndToEndTests.xcscheme +++ b/edX.xcodeproj/xcshareddata/xcschemes/EndToEndTests.xcscheme @@ -1,6 +1,6 @@