Skip to content

Commit f667e53

Browse files
TSI-amrutwaghmareharshada-15-tsys
authored andcommitted
NMC 1937 - E2EE customisation
1 parent 82d6dfe commit f667e53

File tree

3 files changed

+2665
-1944
lines changed

3 files changed

+2665
-1944
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
//
2+
// E2EETests.swift
3+
// NextcloudTests
4+
//
5+
// Created by A200020526 on 26/05/23.
6+
// Copyright © 2023 Marino Faggiana. All rights reserved.
7+
//
8+
9+
@testable import Nextcloud
10+
import XCTest
11+
import TOPasscodeViewController
12+
13+
final class E2EETests: XCTestCase {
14+
15+
var manageE2EE: NCManageE2EE!
16+
17+
override func setUpWithError() throws {
18+
// Put setup code here. This method is called before the invocation of each test method in the class.
19+
manageE2EE = NCManageE2EE()
20+
}
21+
22+
override func tearDownWithError() throws {
23+
// Put teardown code here. This method is called after the invocation of each test method in the class.
24+
manageE2EE = nil
25+
}
26+
27+
func testExample() throws {
28+
// This is an example of a functional test case.
29+
// Use XCTAssert and related functions to verify your tests produce the correct results.
30+
// Any test you write for XCTest can be annotated as throws and async.
31+
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
32+
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
33+
}
34+
35+
func testPerformanceExample() throws {
36+
// This is an example of a performance test case.
37+
self.measure {
38+
// Put the code you want to measure the time of here.
39+
}
40+
}
41+
42+
// MARK: - Initialization
43+
44+
func testInitialization() {
45+
XCTAssertTrue(manageE2EE.endToEndInitialize.delegate === manageE2EE)
46+
XCTAssertFalse(manageE2EE.isEndToEndEnabled)
47+
XCTAssertEqual(manageE2EE.statusOfService, NSLocalizedString("_status_in_progress_", comment: ""))
48+
}
49+
50+
// MARK: - Delegate
51+
52+
func testEndToEndInitializeSuccess() {
53+
manageE2EE.endToEndInitializeSuccess()
54+
XCTAssertTrue(manageE2EE.isEndToEndEnabled)
55+
}
56+
57+
// MARK: - Passcode
58+
59+
func testRequestPasscodeType() {
60+
// TODO: Implement this test case
61+
}
62+
63+
func testCorrectPasscode_startE2E() {
64+
manageE2EE.passcodeType = "startE2E"
65+
manageE2EE.correctPasscode()
66+
// TODO: Add assertions for the expected behavior after entering the correct passcode for starting E2E
67+
}
68+
69+
func testCorrectPasscode_readPassphrase() {
70+
manageE2EE.passcodeType = "readPassphrase"
71+
// TODO: Simulate entering the correct passcode and verify the expected behavior
72+
}
73+
74+
func testCorrectPasscode_removeLocallyEncryption() {
75+
manageE2EE.passcodeType = "removeLocallyEncryption"
76+
// TODO: Simulate entering the correct passcode and verify the expected behavior
77+
}
78+
79+
func testDidPerformBiometricValidationRequest() {
80+
let passcodeViewController = TOPasscodeViewController(passcodeType: .sixDigits, allowCancel: true)
81+
manageE2EE.didPerformBiometricValidationRequest(in: passcodeViewController)
82+
// TODO: Add assertions for the expected behavior after performing biometric validation
83+
}
84+
85+
func testDidTapCancel() {
86+
let passcodeViewController = TOPasscodeViewController(passcodeType: .sixDigits, allowCancel: true)
87+
manageE2EE.didTapCancel(in: passcodeViewController)
88+
// TODO: Add assertions for the expected behavior after tapping cancel
89+
}
90+
}

0 commit comments

Comments
 (0)