File tree 1 file changed +15
-0
lines changed
test/test-manager/src/tests
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,21 @@ pub async fn login_with_retries(
249
249
}
250
250
}
251
251
252
+ /// Ensure that the test runner is logged in to an account.
253
+ ///
254
+ /// This will first check whether we are logged in. If not, it will also try to login
255
+ /// on your behalf. If this function returns without any errors, we are logged in to a valid
256
+ /// account.
257
+ pub async fn ensure_logged_in (
258
+ mullvad_client : & mut MullvadProxyClient ,
259
+ ) -> Result < ( ) , mullvad_management_interface:: Error > {
260
+ if mullvad_client. get_device ( ) . await ?. is_logged_in ( ) {
261
+ return Ok ( ( ) ) ;
262
+ }
263
+ // We are apparently not logged in already.. Try to log in.
264
+ login_with_retries ( mullvad_client) . await
265
+ }
266
+
252
267
/// Try to connect to a Mullvad Tunnel.
253
268
///
254
269
/// # Returns
You can’t perform that action at this time.
0 commit comments