File tree 4 files changed +36
-13
lines changed
MullvadVPN/View controllers/Alert
4 files changed +36
-13
lines changed Original file line number Diff line number Diff line change @@ -108,11 +108,9 @@ class AlertViewController: UIViewController {
108
108
override func viewDidLoad( ) {
109
109
super. viewDidLoad ( )
110
110
111
+ view. accessibilityIdentifier = presentation. accessibilityIdentifier ?? . alertContainerView
111
112
view. backgroundColor = . black. withAlphaComponent ( 0.5 )
112
113
113
- let accessibilityIdentifier = presentation. accessibilityIdentifier ?? . alertContainerView
114
- view. accessibilityIdentifier = accessibilityIdentifier
115
-
116
114
setContent ( )
117
115
setConstraints ( )
118
116
}
Original file line number Diff line number Diff line change @@ -72,4 +72,21 @@ class AccountTests: LoggedOutUITestCase {
72
72
. verifyFailIconShown ( )
73
73
. waitForPageToBeShown ( ) // Verify still on login page
74
74
}
75
+
76
+ func testLogOut( ) throws {
77
+ let newAccountNumber = try MullvadAPIWrapper ( ) . createAccount ( )
78
+ login ( accountNumber: newAccountNumber)
79
+ XCTAssertEqual ( try MullvadAPIWrapper ( ) . getDevices ( newAccountNumber) . count, 1 )
80
+
81
+ HeaderBar ( app)
82
+ . tapAccountButton ( )
83
+
84
+ AccountPage ( app)
85
+ . tapLogOutButton ( )
86
+
87
+ LoginPage ( app)
88
+
89
+ XCTAssertEqual ( try MullvadAPIWrapper ( ) . getDevices ( newAccountNumber) . count, 0 )
90
+ try MullvadAPIWrapper ( ) . deleteAccount ( newAccountNumber)
91
+ }
75
92
}
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ struct InitMutableBufferError: Error {
32
32
let description = " Failed to allocate memory for mutable buffer "
33
33
}
34
34
35
+ struct Device {
36
+ let name : String
37
+ let id : UUID
38
+
39
+ init ( device_struct: MullvadApiDevice ) {
40
+ name = String ( cString: device_struct. name_ptr)
41
+ id = UUID ( uuid: device_struct. id)
42
+ }
43
+ }
44
+
35
45
/// - Warning: Do not change the `apiAddress` or the `hostname` after the time `MullvadApi.init` has been invoked
36
46
/// The Mullvad API crate is using a global static variable to store those. They will be initialized only once.
37
47
///
@@ -113,16 +123,6 @@ class MullvadApi {
113
123
mullvad_api_client_drop ( clientContext)
114
124
}
115
125
116
- struct Device {
117
- let name : String
118
- let id : UUID
119
-
120
- init ( device_struct: MullvadApiDevice ) {
121
- name = String ( cString: device_struct. name_ptr)
122
- id = UUID ( uuid: device_struct. id)
123
- }
124
- }
125
-
126
126
class DeviceIterator {
127
127
private let backingIter : MullvadApiDeviceIterator
128
128
Original file line number Diff line number Diff line change @@ -95,4 +95,12 @@ class MullvadAPIWrapper {
95
95
throw MullvadAPIError . requestError
96
96
}
97
97
}
98
+
99
+ func getDevices( _ account: String ) throws -> [ Device ] {
100
+ do {
101
+ return try mullvadAPI. listDevices ( forAccount: account)
102
+ } catch {
103
+ throw MullvadAPIError . requestError
104
+ }
105
+ }
98
106
}
You can’t perform that action at this time.
0 commit comments