Skip to content

Commit a7808d2

Browse files
committed
fixup! Remove global API endpoint
1 parent 876101b commit a7808d2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

test/test-manager/src/tests/account.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,8 @@ pub async fn clear_devices(device_client: &DevicesProxy) -> anyhow::Result<()> {
278278
}
279279

280280
pub async fn new_device_client() -> anyhow::Result<DevicesProxy> {
281-
use mullvad_api::{proxy::ApiConnectionMode, ApiEndpoint, API};
281+
use mullvad_api::{proxy::ApiConnectionMode, ApiEndpoint};
282282

283-
let api_endpoint = ApiEndpoint::from_env_vars();
284283
let api_host = format!("api.{}", TEST_CONFIG.mullvad_host);
285284

286285
let api_host_with_port = format!("{api_host}:443");
@@ -289,14 +288,11 @@ pub async fn new_device_client() -> anyhow::Result<DevicesProxy> {
289288
.context("failed to resolve API host")?;
290289

291290
// Override the API endpoint to use the one specified in the test config
292-
let _ = API.override_init(ApiEndpoint {
293-
host: Some(api_host),
294-
address: Some(api_address),
295-
..api_endpoint
296-
});
297-
298-
let api = mullvad_api::Runtime::new(tokio::runtime::Handle::current())
299-
.expect("failed to create api runtime");
291+
let endpoint = ApiEndpoint::new(api_host, api_address, false);
292+
293+
let api =
294+
mullvad_api::Runtime::with_custom_endpoint(tokio::runtime::Handle::current(), &endpoint);
295+
300296
let rest_handle = api.mullvad_rest_handle(ApiConnectionMode::Direct.into_provider());
301297
Ok(DevicesProxy::new(rest_handle))
302298
}

0 commit comments

Comments
 (0)